Commit aa62967
feat: migrate to ESM and vitest (#4461)
## Description
This PR migrates the TypeScript testing framework from Jest to Vitest
and transitions the codebase from CommonJS (CJS) to ECMAScript Modules
(ESM).
**Motivation: **
* **Moving from Jest to Vitest:**
* **Performance:** Vitest leverages Vite's build pipeline, resulting in
significantly faster test execution, especially in larger projects. This
speed improvement enhances developer productivity by providing quicker
feedback loops.
* **Vite Integration:** For projects already using Vite, Vitest offers
seamless integration, reducing configuration overhead and providing a
unified development experience.
* **Modern tooling:** Vitest is a modern test framework that is actively
being developed and provides a better developer experience.
* **Migrating from CJS to ESM:**
* **Modern JavaScript:** ESM is the official standard for module systems
in modern JavaScript, offering better static analysis, tree-shaking, and
overall performance.
* **Improved Compatibility:** ESM is the future of JavaScript modules
and ensures better compatibility with modern tooling and libraries.
* **Simplified Dependency Management:** ESM's static imports allow for
more efficient dependency management and better optimization by
bundlers.
**Changes:**
* Replaced Jest with Vitest for unit testing.
* Updated test files to adhere to Vitest syntax.
* Updated configuration files to reflect the changes (e.g.,
`package.json`, `tsconfig.json`).
**Testing:**
* The changes should not introduce any functional regressions.
Thoroughly verify existing test suites using Vitest.
* It is advisable to clear any local cache, such as node\_modules and
dist folders, before building the lambda functions yourself.
* Chages are tested with
* Default example
* Multi runner example
**Related Issues:**
* Fixes #3964
* Fixes #4366
**Potential Risks:**
* While the migration aims for seamless transition, there's a
possibility of encountering minor compatibility issues during the
initial build or test runs. Thorough testing and cache clearing should
mitigate these risks.
**Additional Notes:**
* This migration modernizes the project's tooling and module system,
laying a foundation for future improvements and maintainability.
---------
Co-authored-by: Nadav Sinai <nadav.sinai@philips.com>1 parent ce458fe commit aa62967
File tree
82 files changed
+2778
-3330
lines changed- .devcontainer
- .vscode
- lambdas
- .vscode
- functions
- ami-housekeeper
- src
- control-plane
- src
- aws
- github
- pool
- scale-runners
- gh-agent-syncer
- src
- syncer
- termination-watcher
- src
- webhook
- src
- eventbridge
- runners
- sqs
- webhook
- libs
- aws-powertools-util
- src
- logger
- metrics
- tracer
- aws-ssm-util
- src
- modules
- ami-housekeeper
- runner-binaries-syncer
- runners
- termination-watcher
- webhook
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
82 files changed
+2778
-3330
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 11 | + | |
18 | 12 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 20 | + | |
| 21 | + | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 24 | + | |
38 | 25 | | |
39 | 26 | | |
40 | 27 | | |
41 | 28 | | |
42 | | - | |
| 29 | + | |
43 | 30 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 31 | + | |
47 | 32 | | |
48 | 33 | | |
49 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
0 commit comments