You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Using createFile ensures cleanup even if test fails
24
+
constfakeTscPath=path.join(tmpDir,'fake-tsc')
25
+
constscriptContent='#!/usr/bin/env node\nconsole.log(\'Version 5.3.3\');\nconsole.log(\'tsc: The TypeScript Compiler - Version 5.3.3\');\nconsole.log(\'\');\nconsole.log(\'COMMON COMMANDS\');\n'
26
+
27
+
createFile(fakeTscPath,scriptContent)
28
+
fs.chmodSync(fakeTscPath,'755')
29
+
30
+
constconfigContent=`import { defineConfig } from 'vitest/config'
31
+
export default defineConfig({
32
+
test: {
33
+
typecheck: {
34
+
enabled: true,
35
+
checker: '${fakeTscPath.replace(/\\/g,'/')}',
36
+
},
37
+
},
38
+
})`
39
+
40
+
const{ stderr, stdout }=awaitrunInlineTests({
41
+
'vitest.config.ts': configContent,
42
+
'example.test-d.ts': 'import { expectTypeOf, test } from \'vitest\'\ntest(\'dummy type test\', () => { expectTypeOf(1).toEqualTypeOf<number>() })',
43
+
})
44
+
45
+
// Assert that Vitest caught the help text and threw the descriptive error
46
+
constoutput=stderr+stdout
47
+
expect(output).toContain('TypeScript compiler returned help text instead of type checking results')
48
+
expect(output).toContain('This usually means the tsconfig file was not found')
49
+
expect(output).toContain('Ensure \'tsconfig.json\' exists in your project root')
0 commit comments