Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vscode. VS Code extension for Vitest vitest.dev/vscode
testing vitest vscode
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829import type { WorkerGlobalState } from 'vitest'import { inject } from 'vitest'import { assert } from './utils'
const { watchEveryFile, continuousFiles, rerunTriggered } = inject('__vscode')// @ts-expect-error injected globalconst workerState = globalThis.__vitest_worker__ as WorkerGlobalState
const testFile = workerState.filepath!
assert(testFile, 'Expected workerState.filepath to be set')
// don't run tests that are not watched if rerun was triggered - only collect those testsif (rerunTriggered) { if (!watchEveryFile && !testFileWatched()) // eslint-disable-next-line regexp/no-useless-assertions workerState.config.testNamePattern = /$a/}
function testFileWatched() { return continuousFiles.some((file) => { if (file === testFile) return true if (file[file.length - 1] === '/') return testFile.startsWith(file) return false })}