Closed sf0rman closed 4 months ago
When running test that expects a JSON.parse to fail, the error message shown in CLI vitest run and runs started from vitest vscode extension differ.
JSON.parse
vitest run
In order to satisfy one, the other will faile.
Running this test will pass using vitest run in the cli and will fail if run from the extension.
describe("JSON parse errors", () => { it("JSON parse", () => { expect(() => JSON.parse("JUST SOME TEXT")).toThrowError( new SyntaxError("Unexpected token J in JSON at position 0") ); }); });
Extension v0.6.3
package.json
{ "name": "vitestprob", "version": "1.0.0", "type": "module", "devDependencies": { "@types/node": "20.12.7", "typescript": "5.4.5", "vitest": "1.5.0" } }
vitest.config.ts
import { defineConfig, UserConfigExport } from "vitest/config"; export default defineConfig({ test: { include: ["**/*.test.ts"], environment: "node", cache: false, }, logLevel: "info", esbuild: { sourcemap: "both", }, } satisfies UserConfigExport);
[INFO 10:26:49] Running 1 file(s) with name pattern: ^\s?JSON parse errors JSON parse$
0.6.3
What Node version do you use in a CLI?
I was on node 18, but looks like you've completed this. Thanks! Updated vitest extention and it's all working.
Describe the bug
When running test that expects a
JSON.parse
to fail, the error message shown in CLIvitest run
and runs started from vitest vscode extension differ.In order to satisfy one, the other will faile.
Reproduction
Running this test will pass using
vitest run
in the cli and will fail if run from the extension.Extension v0.6.3
package.json
vitest.config.ts
Output
Version
0.6.3
Validations