Skip to content

different behavior with npm and pnpm #408

@sdavids

Description

@sdavids

Setup

$ mkdir /tmp/test && cd "$_"
$ npm init -y
$ npm i -D @playwright/test@1.53.2 eslint@9.30.1 eslint-plugin-import-x@4.16.1
$ jq '.scripts += {"lint":"eslint ."}' package.json >.tmp && mv .tmp package.json
$ cat <<'EOF' >eslint.config.mjs
import { flatConfigs as importConfigs } from "eslint-plugin-import-x";

export default [importConfigs.recommended];
EOF
$ cat <<'EOF' >playwright.config.mjs
import { defineConfig } from '@playwright/test';

export default defineConfig({});
EOF

npm

Run lint:

$ npm run lint

> test@0.0.1 lint
> eslint .

With npm there will be no error.

pnpm

Get rid of npm stuff and install pnpm stuff …

$ rm -rf node_modules package-lock.json
$ pnpm --silent install

Run lint:

$ pnpm run lint

> [test@0.0.1](mailto:test@0.0.1) lint /private/tmp/test
> eslint .


/private/tmp/test/playwright.config.mjs
  1:10  error  defineConfig not found in '@playwright/test'  import-x/named

✖ 1 problem (1 error, 0 warnings)

 ELIFECYCLE  Command failed with exit code 1.

With pnpm there is an error.


https://playwright.dev/docs/test-configuration

I skipped providing a working playwright setup because it would just clutter this PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions