Open github0013 opened 2 years ago
Thank you for your reporting. Please try simply npx playwright-watch exec echo changed
, and see if it executes twice?
pwuser@07be25028166:/app$ npx playwright-watch exec echo changed
changed
changed
Think it's probably when you save it triggered by .spec.ts
source file and dist file which compiles by tsc at the same time. Write a playwright.config.js
file to match only the source one or dist.
playwright.config.js
testMatch: ".*spec\.ts"
testMatch: ".*spec.ts"
(vscode corrects me .*spec\.ts
to .*spec.ts
)
With this config, I see
=================
no tests found.
=================
Changing that to this ran tests.
testMatch: "*spec.ts"
However, it wasn't really the case as I did more tests. It seems when there are multiple spec.ts files, the initial run gets multiplied by the number of the files. (whether or not you have that testMatch part) e.g. if you had 2 spec.ts files, you get each test file run 2 times
Does it happen on your environment?
Okay, I'll look into it, thank you very much.
same issue here, tests are launched twice in watch mode.
$ yarn test:watch reserv
yarn run v1.22.17
$ playwright-watch exec yarn test reserv
$ playwright test reserv
$ playwright test reserv
Using config at /Users/.../apps/demo-e2e/playwright.config.ts
Using config at /Users/.../apps/demo-e2e/playwright.config.ts
Running 1 test using 1 worker
Running 1 test using 1 worker
I can also confirm the issue only happens when there is multiple test files. (In my case 2 test files)
I happened to me, the first time it launch as many as test file I have in Typescript
Reproduction repo: https://github.com/leosuncin/redux-offline-example
I'm seeing similar issue in a project right now, producing 4 duplicate entries:
npx playwright-watch exec echo changed
changed
changed
changed
changed
Following this PR. I see similar behaviour:
$ npx playwright-watch exec echo changed
changed
changed
changed
changed
changed
Dockerfile
package.json
foo.spec.ts
making sure
yarn test
only runs once for foo.spec.tsyarn test:watch
runs the test twice on the initial runNotice
They are output twice.
💾 HERE, I saved foo.spec.ts to run again
After that, it only runs once on a save.