Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 27, 2025

Our temporary cleanup fix submitted in #36043 doesn't work for tests run with jest, because jest suppresses the standard Node exit event, causing the cleanup to never run.

Instead, we introduce a new public static function which people using jest can call:

afterAll(CloudAssembly.cleanupTemporaryDirectories);

As well as a convenience script to automatically inject this handler into all jest tests:

$ jest --setupFilesAfterEnv aws-cdk-lib/testhelpers/jest-autoclean

Once this PR has been merged and released we will add the above to all CLI init templates.

Closes #802, hopefully for good.


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

Our temporary cleanup fix submitted in #36043 doesn't work for tests run
with `jest`, because `jest` suppresses the standard Node `exit` event,
causing the cleanup to never run.

Instead, we introduce a new public static function which people using
`jest` can call:

```ts
afterAll(CloudAssembly.cleanupTemporaryDirectories);
```

As well as a convenience script to automatically inject this handler
into all jest tests:

```
$ jest --setupFilesAfterEnv aws-cdk-lib/testhelpers/jest-autoclean
```

Once this PR has been merged and released we will add the above to all
CLI init templates.

Closes #802, hopefully for good.
@aws-cdk-automation aws-cdk-automation requested a review from a team November 27, 2025 13:30
@github-actions github-actions bot added bug This issue is a bug. p2 labels Nov 27, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Nov 27, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Nov 27, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 27, 2025 14:36

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify
Copy link
Contributor

mergify bot commented Nov 28, 2025

Merge Queue Status Beta

✅ The pull request has been merged

This pull request spent 28 minutes 27 seconds in the queue, including 28 minutes 4 seconds waiting for CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Contributor

mergify bot commented Nov 28, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Nov 28, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit d284733 into main Nov 28, 2025
16 of 17 checks passed
@mergify mergify bot deleted the huijbers/jest-cleanup branch November 28, 2025 12:44
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET generation needs to use full type names for reused names cross-construct.

3 participants