Skip to content

Commit 6844256

Browse files
perf(test): skip redundant type-check in jest via isolatedModules (#357) (#359)
The CDK Jest suite (//cdk:test) is ~91% of the CI build step (~649s of ~710s on the 4-core runner). ts-jest type-checks every file during the test transform, duplicating the authoritative type-check already done by //cdk:compile (tsc --build) in the same build DAG. Switch both cdk/ and cli/ Jest transforms to a dedicated tsconfig.jest.json that sets isolatedModules:true (transpile-only, no type-check). cdk's jest tsconfig also pins module:CommonJS so dynamic import() downlevels to require() (NodeNext would leave native import(), breaking jest's vm without --experimental-vm-modules). Type-safety is unchanged: //cdk:compile and //cli:compile remain the type-check gate. Local timings (8-core): //cdk:test 314s -> 155s (~2x) //cli:test 104s -> 4s (type-check was nearly the entire CLI cost) All 2041 CDK + 355 CLI tests pass; coverage thresholds unchanged and met. This is an alternative to the @swc/jest approach explored on #357: same speedup, zero test-file changes (no ES import-hoisting fallout). Co-authored-by: bgagent <345885+scottschreckengaust@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 3d6dbbe commit 6844256

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

cdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"^.+\\.[t]sx?$": [
123123
"ts-jest",
124124
{
125-
"tsconfig": "tsconfig.dev.json"
125+
"tsconfig": "tsconfig.jest.json"
126126
}
127127
]
128128
}

cdk/tsconfig.jest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.dev.json",
3+
"compilerOptions": {
4+
"isolatedModules": true,
5+
"module": "CommonJS",
6+
"moduleResolution": "Node"
7+
}
8+
}

cli/package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/tsconfig.jest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.dev.json",
3+
"compilerOptions": {
4+
"isolatedModules": true
5+
}
6+
}

0 commit comments

Comments
 (0)