vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Vitest plugin executes non test files

Open FINDarkside opened this issue 3 years ago • 0 comments

Describe the bug I cannot get the vitest plugin to work in my electron project. The vitest command works just fine, it's just this plugin that's not working. Seems like instead of running the tests it starts to run my electron files from the dist folder even though it's ignored and doesn't even contain any tests.

To Reproduce Repo to reproduce: https://github.com/FINDarkside/TLD-Save-Editor-3/tree/vitest Just click the run tests button of the plugin

Expected behavior Expect the tests to pass like they do when I run npm run test

Screenshots Here's the logs from the failed test run:

[INFO 14.23.46] Tests run start
[INFO 14.23.46] [Workspace "TLD-Save-Editor-3-Vue] Run tests from workspace
[INFO 14.23.46] [Execute Vitest] C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue/node_modules/.bin/vitest.cmd C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue/tests/parser.spec.ts
[INFO 14.23.46] Start api process at port 63908
[INFO 14.23.46] [RUN] C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue/node_modules/.bin/vitest.cmd C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue/tests/parser.spec.ts
[INFO 14.23.46] [RUN.cwd] C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue
---- Bunch of WS Close message ---
[INFO 14.23.48] WS Opened
[INFO 14.23.48] WS Opened
[INFO 14.23.48] 
 DEV  v0.23.4 C:/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue
      API started at http://localhost:63908
vite v3.1.3 building for test...
watching for file changes...
build started...
[INFO 14.23.49] transforming...
✓ 1 modules transformed.
rendering chunks...
dist/electron/preload/index.js   2.14 KiB / gzip: 0.86 KiB
dist/electron/preload/index.js.map 4.01 KiB
built in 331ms.
vite v3.1.3 building for test...
watching for file changes...
build started...
transforming...
✓ 1 modules transformed.
rendering chunks...
dist/electron/main/index.js   2.18 KiB / gzip: 0.91 KiB
dist/electron/main/index.js.map 5.20 KiB
built in 52ms.
[INFO 14.23.49] WS Close
[INFO 14.23.49] WS Close
[INFO 14.23.49] API PROCESS EXIT
[INFO 14.23.49] Vitest api process finished
[Error 14.23.50] Test not found: file:///c%3A/Users/FINDarkside/Ohjelmointi/NodeJS/TLD-Save-Editor-3-Vue/tests/parser.spec.ts/Parser@0
[INFO 14.23.50] [Workspace "TLD-Save-Editor-3-Vue] Test run finished
[INFO 14.23.50] Tests run end
[INFO 14.23.50] C:\Users\FINDarkside\Ohjelmointi\NodeJS\TLD-Save-Editor-3-Vue\dist\electron\main\index.js:6

process.env.PUBLIC = electron.app.isPackaged ? process.env.DIST : path.join(process.env.DIST, "../public");
TypeError: Cannot read properties of undefined (reading 'isPackaged')
    at Object.<anonymous> (C:\Users\FINDarkside\Ohjelmointi\NodeJS\TLD-Save-Editor-3-Vue\dist\electron\main\index.js:6:35)
--- rest of the stacktrace ---

Environment

  • OS: Windows 10 10.0.19043
  • VSCode version: 1.71.2
  • Vitest version: 0.23.4
  • Vitest plugin version: v0.2.29

FINDarkside avatar Oct 01 '22 11:10 FINDarkside