Skip to content

Commit 6227c94

Browse files
authored
chore(aws-cdk-lib): increase jest test speed, remove warnings (#26854)
Two changes to the `jest` tests: - We are currently running the tests directly from `.ts` source files using `ts-jest`. Disable type checking (by setting `isolatedModules: true`) to improve the speed. This brings down running 4 test suites from an arbitrary service (`aws-servicecatalog`) down from `79s` to `19s` on my machine. - Change the "coverage ignore files" a little to get rid of the "Note: The code generator has deoptimised the styling" errors produced by jest when it wants to read the coverage of the generated source files. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 356f302 commit 6227c94

File tree

37 files changed

+203
-160
lines changed

37 files changed

+203
-160
lines changed

nx.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"!{workspaceRoot}/**/tsconfig.json",
1212
"!{workspaceRoot}/**/tsconfig.json",
1313
"!{workspaceRoot}/tsconfig.base.json",
14-
"!{workspaceRoot}/**/tsconfig.tsbuildinfo"
14+
"!{workspaceRoot}/**/tsconfig.tsbuildinfo",
15+
"!{workspaceRoot}/**/jest.config.js"
1516
],
1617
"outputs": [
1718
"{projectRoot}/**/*.integ.*.js.snapshot/*",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"jsii-pacmak": "1.87.0",
2929
"jsii-reflect": "1.87.0",
3030
"jsii-rosetta": "~5.1.10",
31+
"ts-jest": "^29.1.1",
3132
"lerna": "^7.1.5",
3233
"nx": "^16.7.3",
3334
"patch-package": "^6.5.1",

packages/@aws-cdk-testing/cli-integ/test/resource-pool.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { sleep } from '../lib';
22
import { ResourcePool } from '../lib/resource-pool';
33

4+
jest.setTimeout(30_000);
5+
46
const POOL_NAME = 'resource-pool.test';
57

68
test('take and dispose', async () => {

packages/@aws-cdk-testing/framework-integ/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ nyc.config.js
1414

1515
!**/*.snapshot/**/asset.*/**
1616

17-
**/*.ts.snapshot
17+
**/*.ts.snapshot
18+
19+
!jest.config.js
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
// Purposely only run .js files, not .ts files. This is so that the unit tests
4+
// here will use the jsii-compiled version of `aws-cdk-lib`, and not the live-interpreted
5+
// .ts files.
6+
moduleFileExtensions: [
7+
'js',
8+
],
9+
testMatch: [
10+
'<rootDir>/test/**/?(*.)+(test).js',
11+
],
12+
13+
testEnvironment: 'node',
14+
};

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.1e14e895fcbdf65feb0a29e4aa74c6c92a6fb0e41f228bef7ab23627ed409cde/consts.js

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.1e14e895fcbdf65feb0a29e4aa74c6c92a6fb0e41f228bef7ab23627ed409cde/index.js

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.a913a2614f4e118cb83fa3c0dd17575c9adbbdbad4da17aecd505282a25513f8/consts.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.a913a2614f4e118cb83fa3c0dd17575c9adbbdbad4da17aecd505282a25513f8/index.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)