|
1 | | -import {describe, expect, it} from "@jest/globals" |
| 1 | +import {describe, expect, it, jest} from "@jest/globals" |
2 | 2 | import type {CompilerOptions} from "../../core/loaders/tsconfig.loader" |
3 | 3 | import {testVersions, unitTestInput} from "../../test/input.test-utils" |
4 | 4 | import {ImportBuilder} from "./import-builder" |
5 | 5 | import {TypeBuilder, type TypeBuilderConfig} from "./type-builder" |
6 | 6 | import {TypescriptFormatterBiome} from "./typescript-formatter.biome" |
7 | 7 |
|
8 | | -import {typecheck} from "../../test/typescript.test-utils" |
| 8 | +import { |
| 9 | + startWorkerPool, |
| 10 | + stopWorkerPool, |
| 11 | + typecheckInWorker, |
| 12 | +} from "../../test/typescript-compiler-worker-pool.test-utils" |
9 | 13 | import {CompilationUnit} from "./compilation-units" |
10 | 14 |
|
11 | 15 | describe.each(testVersions)( |
12 | 16 | "%s - typescript/common/type-builder", |
13 | 17 | (version) => { |
| 18 | + beforeAll(() => { |
| 19 | + startWorkerPool() |
| 20 | + }) |
| 21 | + |
| 22 | + afterAll(() => { |
| 23 | + stopWorkerPool() |
| 24 | + }) |
| 25 | + |
14 | 26 | it("can build a type for a simple object correctly", async () => { |
15 | 27 | const {code, types} = await getActual("components/schemas/SimpleObject") |
16 | 28 |
|
@@ -460,7 +472,22 @@ describe.each(testVersions)( |
460 | 472 | ) |
461 | 473 | const types = builder.toCompilationUnit() |
462 | 474 |
|
463 | | - await typecheck([usage, builder.toCompilationUnit()]) |
| 475 | + await typecheckInWorker([ |
| 476 | + { |
| 477 | + filename: usage.filename, |
| 478 | + content: usage.getRawFileContent({ |
| 479 | + allowUnusedImports: false, |
| 480 | + includeHeader: false, |
| 481 | + }), |
| 482 | + }, |
| 483 | + { |
| 484 | + filename: types.filename, |
| 485 | + content: types.getRawFileContent({ |
| 486 | + allowUnusedImports: false, |
| 487 | + includeHeader: false, |
| 488 | + }), |
| 489 | + }, |
| 490 | + ]) |
464 | 491 |
|
465 | 492 | return { |
466 | 493 | code: ( |
|
0 commit comments