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

Does not support vitest 0.29 or newer on Windows #160

Closed
IGx89 opened this issue May 22, 2023 · 4 comments · Fixed by #161
Closed

Does not support vitest 0.29 or newer on Windows #160

IGx89 opened this issue May 22, 2023 · 4 comments · Fixed by #161
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@IGx89
Copy link
Contributor

IGx89 commented May 22, 2023

Describe the bug
Getting a "test results not found" error on vitest 0.29, 0.30, and 0.31 on Windows.

It appears to be due to the system drive not being part of the path. This extension runs npx vitest --api.host 127.0.0.1 /Development/vitest-dev-vscode/samples/basic/src/should_included_test.ts, for example, which also fails to find tests when run directly from the command line. If I change it to npx vitest --api.host 127.0.0.1 C:/Development/vitest-dev-vscode/samples/basic/src/should_included_test.ts however, it works great. Appears Vitest 0.29+ requires system drive on the path?

To Reproduce
Steps to reproduce the behavior on the example project:

  1. Open https://github.com/vitest-dev/vscode/tree/main/samples/basic (setup script failed for me on the other basic example and the test run would hang)
  2. Update vitest in package.json to 0.29, 0.30 or 0.31
  3. Open Test Exporer pane and click the Run icon next to a test file

Expected behavior
Tests run

Actual behavior
Error saying test results not found

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

(Paste info.txt content generated by the example project)

  • OS: Windows 11
  • VSCode version: 1.78.2
  • Vitest version: 0.31.1
  • Vitest plugin version: 0.2.41

Additional context
Output:

[INFO 4:29:33 PM] Trying to get vitest version from c:\Development\vitest-dev-vscode\samples\basic\node_modules\.bin\vitest.cmd -v...
[INFO 4:29:34 PM] vitest/0.31.1 win32-x64 node-v16.20.0

[INFO 4:29:34 PM] Vitest Workspace [basic]: Vitest version = 0.31.1
[INFO 4:29:38 PM] Tests run start
[INFO 4:29:38 PM] [Workspace "basic] Run tests from workspace
[INFO 4:29:38 PM] [Execute Vitest] npx vitest --api.host 127.0.0.1 /Development/vitest-dev-vscode/samples/basic/src/should_included_test.ts
[INFO 4:29:38 PM] Start api process at port 53163
[INFO 4:29:38 PM] [RUN] npx vitest --api.host 127.0.0.1 /Development/vitest-dev-vscode/samples/basic/src/should_included_test.ts
[INFO 4:29:38 PM] [RUN.cwd] c:/Development/vitest-dev-vscode/samples/basic
[INFO 4:29:38 PM] WS Close
[INFO 4:29:38 PM] RECONNECT
[INFO 4:29:38 PM] WS Close
[INFO 4:29:39 PM] RECONNECT
[INFO 4:29:39 PM] WS Close
[INFO 4:29:39 PM] RECONNECT
[INFO 4:29:39 PM] WS Close
[Error 4:29:40 PM] Process exited with code 1
[INFO 4:29:40 PM] RECONNECT
[INFO 4:29:40 PM] WS Close
[INFO 4:29:40 PM] 

 DEV  v0.31.1 c:/Development/vitest-dev-vscode/samples/basic

      API started at http://127.0.0.1,127.0.0.1:53163



filter:  /Development/vitest-dev-vscode/samples/basic/src/should_included_test.ts

include: src/should_included_test.ts, test/**/*.test.ts

exclude:  test/ignored.test.ts

watch exclude:  **/node_modules/**, **/dist/**



No test files found, exiting with code 1
@IGx89 IGx89 added the p3-minor-bug An edge case that only affects very specific usage (priority) label May 22, 2023
@saitonakamura
Copy link
Contributor

It looks like code that was introduced in 5c58ede#diff-5cc0f46523c911252e1682b9e32c10b10460515187b16b1b47a872f5202b1fe6L127 may be the culprit
Only introducing drive letter back and capitalizing it fixes it for me when running from the powershell
Those 2 are working

> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd C:/Users/saito/code/srs/src/modules/game.test.ts -t "game"
> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd C:\Users\saito\code\srs\src\modules\game.test.ts -t "game"

 DEV  v0.31.1 C:/Users/saito/code/srs

 ✓ src/modules/game.test.ts (7)

 Test Files  1 passed (1)
      Tests  7 passed (7)
   Start at  16:06:11
   Duration  590ms (transform 61ms, setup 0ms, collect 46ms, tests 4ms, environment 0ms, prepare 176ms)


 PASS  Waiting for file changes...
       press h to show help, press q to quit

All those are not

> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd /Users/saito/code/srs/src/modules/game.test.ts -t "game"
> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd \Users\saito\code\srs\src\modules\game.test.ts -t "game"
> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd c:/Users/saito/code/srs/src/modules/game.test.ts -t "game"
> c:/Users/saito/code/srs/node_modules/.bin/vitest.cmd c:\Users\saito\code\srs\src\modules\game.test.ts -t "game"

 DEV  v0.31.1 C:/Users/saito/code/srs

filter:  /Users/saito/code/srs/src/modules/game.test.ts
include: **/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}
exclude:  tests, node_modules
watch exclude:  **/node_modules/**, **/dist/**

No test files found, exiting with code 1

@AniaKru95
Copy link

I have the same issue on Windows.
Lower version works ok.

@Wyatex
Copy link

Wyatex commented Jun 19, 2023

0.31 works ok,but 0.32 reproduced.

@callmeberzerker
Copy link

I am still experiencing this... why is this closed?

@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants