|
| 1 | +import { expect, test } from 'vitest' |
| 2 | +import { runInlineTests } from '../../test-utils' |
| 3 | + |
| 4 | +test('typecheck tasks create specifications for the typescript pool', async () => { |
| 5 | + const { ctx } = await runInlineTests( |
| 6 | + { |
| 7 | + 'basic.check.ts': /* ts */ ` |
| 8 | + import { describe, expectTypeOf, test } from 'vitest' |
| 9 | + describe('suite', () => { |
| 10 | + test('number is a number', () => { |
| 11 | + expectTypeOf(1).toBeNumber() |
| 12 | + }) |
| 13 | + }) |
| 14 | + `, |
| 15 | + 'tsconfig.json': JSON.stringify({ |
| 16 | + compilerOptions: { |
| 17 | + strict: true, |
| 18 | + noEmit: true, |
| 19 | + target: 'esnext', |
| 20 | + module: 'esnext', |
| 21 | + moduleResolution: 'bundler', |
| 22 | + skipLibCheck: true, |
| 23 | + }, |
| 24 | + include: ['*.check.ts'], |
| 25 | + }), |
| 26 | + }, |
| 27 | + { typecheck: { enabled: true, only: true, include: ['*.check.ts'] } }, |
| 28 | + ) |
| 29 | + |
| 30 | + const [testModule] = ctx!.state.getTestModules() |
| 31 | + const [testSuite] = testModule.children.suites() |
| 32 | + const [testCase] = testSuite.children.tests() |
| 33 | + |
| 34 | + const moduleSpecification = testModule.toTestSpecification() |
| 35 | + expect(moduleSpecification.pool).toBe('typescript') |
| 36 | + expect(moduleSpecification.testModule).toBe(testModule) |
| 37 | + |
| 38 | + const suiteSpecification = testSuite.toTestSpecification() |
| 39 | + expect(suiteSpecification.pool).toBe('typescript') |
| 40 | + expect(suiteSpecification.testModule).toBe(testModule) |
| 41 | + |
| 42 | + const caseSpecification = testCase.toTestSpecification() |
| 43 | + expect(caseSpecification.pool).toBe('typescript') |
| 44 | + expect(caseSpecification.testModule).toBe(testModule) |
| 45 | +}) |
0 commit comments