firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
265 stars 124 forks source link

Support vitest #235

Open holtwick opened 2 years ago

holtwick commented 2 years ago

Your great extension could support Vitest out of the box once https://github.com/vitest-dev/vitest/issues/838 is fixed. Maybe you'd like to add that to your features list? It is sufficient to set jestCommand option accordingly.

Thanks for the great extension, I use it every day :)

bennycode commented 1 year ago

I am also using "vitest" in some of my project and the "Jest Runner" thinks these are Jest tests and renders a "Run" button.

When clicking the "Run" button the tests fail (because those are Vitests):

node '/home/bennycode/dev/bennycode/typescript4free/node_modules/jest/bin/jest.js'/home/bennycode/dev/bennycode/typescript4free/src/utils/sorting.test.ts' -t 'sorting finishes sorting one directory before going to the next' node:internal/modules/cjs/loader:1080 throw err; Error: Cannot find module '/home/bennycode/dev/bennycode/typescript4free/node_modules/jest/bin/jest.js'

My test cases have the following import headers:

import {describe, expect, it} from 'vitest';

@firsttris is it possible to not render the "Run" button when imports from "vitest" are being found in the test file?