Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Dec 1, 2025

We are now running every test file through ts-jest, which means all TypeScript
code gets parsed again and again for every test.

Instead, in this PR we run our tests in 2 different ways:

  • In a dev environment, as TypeScript for quick iteration
  • In a CI environment, as JavaScript for higher throughput execution

Needs some related changes to the tests to make it all work out properly:

  • We need to update the snapshot resolver to always name the snapshots *.ts.snap (not sometimes *.ts.snap and sometimes *.js.snap)
  • We need to explicitly set up babel-jest so that mock hoisting still works.
  • We must use the jest.mock() implicit global in order for mock hoisting to work with babel-jest, so can't have explicit imports.
  • cx-api was not compiling its tests so we couldn't run .js tests.
  • Had to remove a stray custom resource test, as it was not being run and was in a broken state that took too much effort to fix.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 1, 2025 10:22
@github-actions github-actions bot added the p2 label Dec 1, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Dec 1, 2025
…erwrite input file

We have been starting to get the above error, because of the style
of imports we've been using.

If *inside* `aws-cdk-lib` we use an import of the form:

```ts
import * as iam from 'aws-cdk-lib/aws-iam';
```

Then we add an `index.d.ts` file to the set of inputs, despite there
being an `index.ts` right next to it.

Undo that everywhere, and add a linter rule for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant