Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In a configuration with multiple vitest.config.ts, Run Test returns the same result as the previous one. #469

Closed
4 tasks done
onozaty opened this issue Sep 14, 2024 · 1 comment

Comments

@onozaty
Copy link

onozaty commented Sep 14, 2024

Describe the bug

There is a monorepo project with multiple vitest.config.ts.
They are not configured in workspace.

.
├── a
│   ├── node_modules
│   ├── package.json
│   ├── package-lock.json
│   ├── src
│   │   ├── sum1.test.ts
│   │   └── sum1.ts
│   ├── tsconfig.json
│   └── vitest.config.ts
└── b
    ├── node_modules
    ├── package.json
    ├── package-lock.json
    ├── src
    │   ├── sum2.test.ts
    │   └── sum2.ts
    ├── tsconfig.json
    └── vitest.config.ts

In this state, if the following steps are taken, the test will not fail at 3.
It seems that the test is executed again in the state of 1.

  1. Run tests with "Run Test".
  2. Change the test code so that the test fails.
  3. Re-run the test with "Run Test".

"Debug Test" instead of "Run Test" resulted in a run against the current code.

vitest-1

Other informations.

  • The same is true when run from Test Explorer.
  • No problem with npm run test.
  • If vitest.config.ts in one of the folders is deleted so that there is only one vitest.config.ts, this problem will not occur.

Reproduction

I have placed the reproduced code below.

Output

[INFO 3:34:09 AM] [v1.2.8] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 3:34:10 AM] [API] Running Vitest v2.1.0 (b/vitest.config.ts) with Node.js: /usr/local/bin/node
[INFO 3:34:10 AM] [API] Running Vitest v2.1.0 (a/vitest.config.ts) with Node.js: /usr/local/bin/node
[INFO 3:34:11 AM] [API] Vitest v2.1.0 (a/vitest.config.ts) process 3646 created
[INFO 3:34:11 AM] [API] Vitest v2.1.0 (b/vitest.config.ts) process 3645 created
[INFO 3:34:11 AM] [API] Collecting tests: a/src/sum1.test.ts
[3:34:11 AM] Not starting the runner because tests are being collected
[3:34:11 AM] There is no test run for "sum1.test.ts"
[3:34:11 AM] No test run to finish for /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts
[INFO 3:34:23 AM] Running 1 file(s) with name pattern: ^\s?a tset 1$
[3:34:23 AM] The runner is starting because tests /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts were started due to a file change
[3:34:23 AM] Enqueuing "a tset 1"
[3:34:23 AM] No task result for "a tset 1", assuming the test just started running
[3:34:23 AM] Marking "a tset 1" as passed
[3:34:23 AM] Ending test run a/src/sum1.test.ts
[INFO 3:34:28 AM] Running 1 file(s) with name pattern: ^\s?a tset 1$
[3:34:28 AM] The runner is starting because tests /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts were started due to a file change
[3:34:28 AM] Enqueuing "a tset 1"
[3:34:29 AM] No task result for "a tset 1", assuming the test just started running
[3:34:29 AM] Marking "a tset 1" as passed
[3:34:29 AM] Ending test run a/src/sum1.test.ts
[INFO 3:34:32 AM] Running 1 file(s) with name pattern: ^\s?a tset 1$
[3:34:32 AM] The runner is starting because tests /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts were started due to a file change
[3:34:32 AM] Enqueuing "a tset 1"
[3:34:32 AM] No task result for "a tset 1", assuming the test just started running
[3:34:32 AM] Marking "a tset 1" as passed
[3:34:32 AM] Ending test run a/src/sum1.test.ts
[INFO 3:34:35 AM] [DEBUG] Debugging started
[INFO 3:34:36 AM] Running 1 file(s) with name pattern: ^\s?a tset 1$
[3:34:36 AM] The runner is starting because tests /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts were started due to a file change
[3:34:36 AM] Enqueuing "a tset 1"
[3:34:37 AM] No task result for "a tset 1", assuming the test just started running
[3:34:37 AM] No errors found for "sum1.test.ts"
[3:34:37 AM] Marking "a tset 1" as failed with 1 errors
[3:34:37 AM] No errors found for "sum1.test.ts"
[3:34:37 AM] Ending test run a/src/sum1.test.ts
[3:34:37 AM] Disposing test runner
[INFO 3:34:41 AM] Running 1 file(s) with name pattern: ^\s?a tset 1$
[3:34:41 AM] The runner is starting because tests /workspaces/node-sandbox/vitest-monorepo/a/src/sum1.test.ts were started due to a file change
[3:34:41 AM] Enqueuing "a tset 1"
[3:34:41 AM] No task result for "a tset 1", assuming the test just started running
[3:34:41 AM] Marking "a tset 1" as passed
[3:34:41 AM] Ending test run a/src/sum1.test.ts

Version

v1.2.8

Validations

@sheremet-va
Copy link
Member

Fixed in https://github.com/vitest-dev/vscode/releases/tag/v1.2.9

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants