vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
743 stars 84 forks source link

Does not support vitest 0.29 or newer on Windows #160

Closed IGx89 closed 1 year ago

IGx89 commented 1 year ago

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)

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
saitonakamura commented 1 year ago

It looks like code that was introduced in https://github.com/vitest-dev/vscode/commit/5c58edeb3580f9c378c6a38de76ae8fd6062c07c#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 commented 1 year ago

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

Wyatex commented 1 year ago

0.31 works ok,but 0.32 reproduced.

callmeberzerker commented 11 months ago

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