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

New tests are not discovered / previous results displayed #485

Closed
4 tasks done
olafure opened this issue Oct 2, 2024 · 4 comments
Closed
4 tasks done

New tests are not discovered / previous results displayed #485

olafure opened this issue Oct 2, 2024 · 4 comments

Comments

@olafure
Copy link

olafure commented Oct 2, 2024

Describe the bug

New test files are not detected.
Once detected, previous results are shown.
See reproduction section.

Reproduction

Use this repository.

  1. Start with a clean repo.
  2. Open in VSCode.
  3. pnpm install
  4. cd samples/basic
  5. pnpm install
  6. cd ../..
  7. pnpm run dev
  8. Hit F5 to run the extension. samples/basic project will open.
  9. Create a new file, test/bug.test.ts, paste this content:
import { expect, test } from 'vitest';
test('fail', () => {
  expect(1).toEqual(2);
})
  1. Hit save.

Expected:
I'd expect to see the green arrow to run the test.
Even if I open another file and go back to this one, I don't see the green arrow.
I can run the test by opening VSCode's test panel and click "Run all". Then it's detected.

Once detected, the green button will appear. But when I click it, previous test run is returned.
You can see that by changing the expect line to expect(1).toEqual(1) .
The test should succeed when you click the green button next to it, but won't until you click it again.

Output

[INFO 17:54:14] [v1.2.17] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 17:54:15] [API] Running Vitest v1.4.0 (basic/vitest.config.ts) with Node.js@v20.13.1: /home/user/.nvm/versions/node/v20.13.1/bin/node 
[INFO 17:54:15] [Worker] Starting inspector on 127.0.0.1:53815 failed: address already in use
[INFO 17:54:16] [API] Vitest v1.4.0 (basic/vitest.config.ts) process 52987 created
[INFO 17:54:35] [Worker] Collecting tests due to file changes: test/bug.test.ts
[INFO 17:54:37] [Worker] Collecting tests due to file changes: test/bug.test.ts

Version

1.2.17 (63f3dfe)

Validations

@neoscrib
Copy link

neoscrib commented Oct 2, 2024

Duplicate of #483

@olafure
Copy link
Author

olafure commented Oct 2, 2024

Duplicate of #483

It might not be a duplicate, although similar. #483 says: The only way to rerun tests files and get new data is to click "Refresh tests"

Multiple issues have been introduced into the 1.2.x versions. This issue existed before #483 got introduced where the only way is to click "refresh all".

Duplicate or not, this one at least provides the missing Reproduction section.

@sheremet-va
Copy link
Member

The reproduction works fine for me with the latest version. The file is added to the tree list and the tests are collected

Screenshot 2024-10-03 at 12 47 47

Please, check 1.2.18 version, there were issues with the default glob that the extension was using: #472

@olafure
Copy link
Author

olafure commented Oct 3, 2024

Confirmed fixed in 1.2.18. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants