Commit d284733
authored
fix(core): temp cleanup does not work with jest (#36226)
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.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent b956492 commit d284733
File tree
4 files changed
+76
-5
lines changed- packages/aws-cdk-lib
- cx-api/lib
- testhelpers
- tools/@aws-cdk/cdk-build-tools/config
4 files changed
+76
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
36 | 83 | | |
37 | 84 | | |
38 | 85 | | |
| |||
498 | 545 | | |
499 | 546 | | |
500 | 547 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
| 548 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
| 533 | + | |
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
1 | 11 | | |
2 | 12 | | |
3 | 13 | | |
| |||
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
| 44 | + | |
| 45 | + | |
34 | 46 | | |
0 commit comments