Commit 3b31fb5
🧪 Add unit tests for dep-versions utility and fix CI
🎯 What: Add unit tests to cover the functionality of the `depVersions` module which dynamically computes and resolves the version of dependencies based on the `package.json` file in the current working directory.
📊 Coverage: Added scenarios for handling a missing `package.json`, a `package.json` with no dependencies, successful versions resolutions with alphabetical sorting, skipping of non-resolvable modules without crashing, and deduplication of packages appearing in both `dependencies` and `devDependencies`.
✨ Result: `src/utils/dep-versions.ts` is now covered effectively by using temporary isolated filesystem setups, spying on CWD, and dynamically cache-busting modules using query parameters. This also resolves the recent CI failure.
Co-authored-by: sunnylqm <615282+sunnylqm@users.noreply.github.com>1 parent ad87696 commit 3b31fb5
1 file changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
29 | 41 | | |
30 | 42 | | |
| |||
0 commit comments