diff --git a/packages/browser/src/node/plugin.ts b/packages/browser/src/node/plugin.ts index 73f43899d760..8bab85816f3a 100644 --- a/packages/browser/src/node/plugin.ts +++ b/packages/browser/src/node/plugin.ts @@ -364,7 +364,7 @@ export default (parentServer: ParentBrowserProject, base = '/'): Plugin[] => { name: 'vitest:browser:in-source-tests', transform(code, id) { const project = parentServer.vitest.getProjectByName(parentServer.config.name) - if (!project.isCachedTestFile(id) || !code.includes('import.meta.vitest')) { + if (!project._isCachedTestFile(id) || !code.includes('import.meta.vitest')) { return } const s = new MagicString(code, { filename: cleanUrl(id) }) diff --git a/packages/vitest/src/node/project.ts b/packages/vitest/src/node/project.ts index 1e156da24c5c..eeb6b977e726 100644 --- a/packages/vitest/src/node/project.ts +++ b/packages/vitest/src/node/project.ts @@ -394,7 +394,7 @@ export class TestProject { * Returns if the file is a test file. Requires `.globTestFiles()` to be called first. * @internal */ - isCachedTestFile(testPath: string): boolean { + _isCachedTestFile(testPath: string): boolean { return !!this.testFilesList && this.testFilesList.includes(testPath) } @@ -402,7 +402,7 @@ export class TestProject { * Returns if the file is a typecheck test file. Requires `.globTestFiles()` to be called first. * @internal */ - isCachedTypecheckFile(testPath: string): boolean { + _isCachedTypecheckFile(testPath: string): boolean { return !!this.typecheckFilesList && this.typecheckFilesList.includes(testPath) } @@ -430,7 +430,7 @@ export class TestProject { * Test if a file matches the test globs. This does the actual glob matching if the test is not cached, unlike `isCachedTestFile`. */ public matchesTestGlob(moduleId: string, source?: () => string): boolean { - if (this.isCachedTestFile(moduleId)) { + if (this._isCachedTestFile(moduleId)) { return true } const relativeId = relative(this.config.dir || this.config.root, moduleId) diff --git a/packages/vitest/src/node/specifications.ts b/packages/vitest/src/node/specifications.ts index 346300718006..e57d79ce9ba1 100644 --- a/packages/vitest/src/node/specifications.ts +++ b/packages/vitest/src/node/specifications.ts @@ -21,10 +21,10 @@ export class VitestSpecifications { const specs: TestSpecification[] = [] for (const project of this.vitest.projects) { - if (project.isCachedTestFile(moduleId)) { + if (project._isCachedTestFile(moduleId)) { specs.push(project.createSpecification(moduleId)) } - if (project.isCachedTypecheckFile(moduleId)) { + if (project._isCachedTypecheckFile(moduleId)) { specs.push(project.createSpecification(moduleId, [], 'typescript')) } } diff --git a/packages/vitest/src/node/watcher.ts b/packages/vitest/src/node/watcher.ts index 4d721e91c283..0db9f78649e1 100644 --- a/packages/vitest/src/node/watcher.ts +++ b/packages/vitest/src/node/watcher.ts @@ -123,7 +123,7 @@ export class VitestWatcher { if (!projects.length) { // if there are no modules it's possible that server was restarted // we don't have information about importers anymore, so let's check if the file is a test file at least - if (this.vitest.state.filesMap.has(filepath) || this.vitest.projects.some(project => project.isCachedTestFile(filepath))) { + if (this.vitest.state.filesMap.has(filepath) || this.vitest.projects.some(project => project._isCachedTestFile(filepath))) { this.changedTests.add(filepath) return true } @@ -142,7 +142,7 @@ export class VitestWatcher { this.invalidates.add(filepath) // one of test files that we already run, or one of test files that we can run - if (this.vitest.state.filesMap.has(filepath) || project.isCachedTestFile(filepath)) { + if (this.vitest.state.filesMap.has(filepath) || project._isCachedTestFile(filepath)) { this.changedTests.add(filepath) files.push(filepath) continue