[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix(typecheck): don't panic during `vitest list` command (#7933)

authored by

Vladimir and committed by
GitHub
(May 6, 2025, 10:36 PM +0200) ba6da4d0 525f524c

+24 -4
+2
test/cli/test/list.test.ts
··· 7 7 ['--pool=forks'], 8 8 ['--pool=vmForks'], 9 9 ['--browser.enabled'], 10 + ['--typecheck'], 11 + ['--typecheck.only'], 10 12 ])('correctly outputs all tests with args: "%s"', async (...args) => { 11 13 const { stdout, exitCode } = await runVitestCli('list', '-r=./fixtures/list', ...args) 12 14 expect(stdout).toMatchSnapshot()
+5
test/cli/fixtures/list/type.test-d.ts
··· 1 + import { expectTypeOf, it } from 'vitest' 2 + 3 + it('1 plus 1', () => { 4 + expectTypeOf(1 + 1).toBeNumber() 5 + })
+16
test/cli/test/__snapshots__/list.test.ts.snap
··· 59 59 " 60 60 `; 61 61 62 + exports[`correctly outputs all tests with args: "--typecheck" 1`] = ` 63 + "type.test-d.ts > 1 plus 1 64 + basic.test.ts > basic suite > inner suite > some test 65 + basic.test.ts > basic suite > inner suite > another test 66 + basic.test.ts > basic suite > basic test 67 + basic.test.ts > outside test 68 + math.test.ts > 1 plus 1 69 + math.test.ts > failing test 70 + " 71 + `; 72 + 73 + exports[`correctly outputs all tests with args: "--typecheck.only" 1`] = ` 74 + "type.test-d.ts > 1 plus 1 75 + " 76 + `; 77 + 62 78 exports[`json output shows error 1`] = ` 63 79 "Error: describe error 64 80 ❯ describe-error.test.ts:4:9
+1 -4
packages/vitest/src/node/pools/typecheck.ts
··· 118 118 checker.setFiles(files) 119 119 await checker.collectTests() 120 120 const testFiles = checker.getTestFiles() 121 - for (const file of testFiles) { 122 - await ctx._testRun.enqueued(project, file) 123 - } 124 - await ctx._testRun.collected(project, testFiles) 121 + ctx.state.collectFiles(project, testFiles) 125 122 } 126 123 } 127 124