-
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
The extension crashes if it encounters a package.json that isn't valid JSON.
I encountered this in my project because I have a templated package.json file (I replace the templated pieces later) and the template itself is not valid JSON.
Reproduction
Add a package.json file to the project that doesn't contain valid JSON.
https://github.com/TomerAberbach/vitest-extension-bug
Output
[INFO 4:23:52 PM] [v0.0.0] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[Error 4:23:52 PM] [Error SyntaxError] /Users/tomeraberbach/Desktop/vitest-bug/dir/package.json: Unexpected token 'i', "invalid
" is not valid JSON
SyntaxError: /Users/tomeraberbach/Desktop/vitest-bug/dir/package.json: Unexpected token 'i', "invalid
" is not valid JSON
at parse (<anonymous>)
at Module._extensions..json (node:internal/modules/cjs/loader:1860:39)
at Module.load (node:internal/modules/cjs/loader:1448:32)
at Module._load (node:internal/modules/cjs/loader:1270:12)
at c._load (node:electron/js2c/node_init:2:17993)
at e._load (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:405:6054)
at t._load (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:223:22716)
at r._load (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:215:24094)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
at Module.require (node:internal/modules/cjs/loader:1470:12)
at require (node:internal/modules/helpers:147:16)
at /Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:13:18167
at Array.forEach (<anonymous>)
at yv (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:13:18134)
at async Xl (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:13:17448)
at async Wo._defineTestProfiles (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:32:2170)
at async Wo.defineTestProfiles (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:32:1997)
at async Wo.activate (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:32:8563)
at async tT (/Users/tomeraberbach/.vscode/extensions/vitest.explorer-1.38.1/dist/extension.js:32:660)
at async aA.n (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:13398)
at async aA.m (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:13361)
at async aA.l (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:12817)Extension Version
1.38.1
Vitest Version
4.0.18
Validations
- Check that you are using the latest version of the extension
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)