Commit ecc44bf
chore(deps): update dependency vitest to v4 [security] (finos#2556)
* chore(deps): update dependency vitest to v4 [security]
* chore(deps): align @vitest/coverage-v8 and @vitest/ui with vitest v4
Renovate's vitest 3 -> 4 bump in this PR left @vitest/coverage-v8 and
@vitest/ui on ^3, but vitest@4 declares peerOptional matching its own
major (e.g. @vitest/ui@"4.1.8" from vitest@4.1.8). npm ci therefore
refused to install with an ERESOLVE, failing every CI job before tests
could run.
Bumps the companion packages to ^4 in the root devDependencies and in
the four calm-suite/calm-studio workspaces that also pinned
@vitest/coverage-v8@^3. Lockfile regenerated incrementally; all 105
linux / 28 darwin / 35 win32 platform variants preserved.
This unblocks npm ci but does not address downstream vitest@4 mock
breaking changes (vi.fn(arrow) no longer constructable, v8 coverage
branch-count drift) that surface in cli, shared, calm-plugins/vscode,
calm-widgets and a couple of calm-studio tests once installs succeed -
those need a separate migration pass.
* test: migrate test suites to vitest v4
Vitest v4 tightened mocking and module resolution. This commit makes
the existing tests pass under v4 without changing behaviour:
* Convert `vi.fn(arrow)` / `mockImplementation(arrow)` to function
expressions. In v4, arrow-function implementations cannot be called
with `new` (TypeError: ... is not a constructor) - tests that mock
constructor calls were failing across cli, shared, calm-plugins/vscode,
calm-widgets and calm-suite/calm-studio. The function-expression form
is semantically identical for non-constructor calls and constructable
for `new`. See https://vitest.dev/guide/migration.html.
* Add a `default` condition to `@finos/calm-models`'s `exports` map for
every subpath. v4's resolver (via newer Vite) no longer falls back
from `import` to `default` implicitly, breaking calm-server tests
that transitively imported `@finos/calm-models/canonical`.
* Lower the branch-coverage threshold from 85 to 78 in calm-models,
calm-widgets, shared and cli. v4's v8 coverage reporter counts
branches more strictly than v3 (observed drop of ~3-5 points on
unchanged source); 78 keeps a meaningful gate while accommodating
the new measurement.
All workspace test suites now pass with coverage enabled on Node 22.
* fix(calm-widgets): re-include @types/node in tsconfig types
The workspace's tsconfig.json overrode the base config's
`"types": ["vitest", "node"]` with `"types": ["vitest"]`, dropping the
Node types. Under vitest 3, the bundled `vitest` types transitively
pulled in @types/node so this went unnoticed; under vitest 4 the type
surface was cleaned up, leaving `__dirname`, `fs` and `path` unresolved
during DTS generation (TS2304).
This cascaded into every PR 2556 CI job that builds calm-widgets as a
dependency (Shared, CLI, VSCode Extension, CALM Server).
* test(calm-hub-ui): apply vitest v4 vi.fn arrow→function conversion
Same root cause as 0299dd1 - I scoped the original migration to the
workspaces that surfaced in earlier failed CI checks and missed
calm-hub-ui, which has its own workflow ("Build CALM Hub UI") whose
"Build, Test, and Lint Shared Module" job tests the calm-hub-ui
sources rather than @finos/calm-shared.
Six React Testing Library specs were affected. 700/700 tests pass
locally on Node 22.22.2.
* test: backfill tests and revert v4 threshold lowering
Vitest 4's v8 coverage reporter counts branches more strictly than v3
(short-circuit operators, nullish coalescing, optional chaining, default
parameters all now contribute branches that v3 silently elided). Same
source code measures 3–5 points lower under v4.
The previous commit lowered the branch threshold from 85 to 78 across
calm-models, calm-widgets, shared and cli to paper over this. That was
the wrong call — the threshold was a quality gate, and lowering it on
account of measurement drift loses information. This commit reverts the
threshold to 85 and instead writes real tests for the branches v4 now
surfaces, restoring the original gate honestly:
* calm-models — 82.27% → 90.71% — adds the missing canonical/
template-models spec (5 type guards, visitRelationship dispatch for
all five relationship kinds plus the default, toKindView).
* calm-widgets — 82.41% → 85.06% — adds flow-sequence cases for
composed-of/options/missing-relationship paths and validateContext
guards; adds related-nodes cases for every node-id branch in the
filter (interacts actor/nodes, deployed-in container/nodes,
composed-of, options-default).
* shared — 81.00% → 85.06% — adds full logger.spec for the node and
browser branches; covers pretty-output's info/hint severities,
fallback header/code paths, snippet trimming and out-of-range
branches; covers flow-sequence-helper for all kind branches and
empty-nodes fallbacks; covers control-registry's no-controls and
duplicate-pass branches; covers handlers.ts (msw test infra) directly;
covers c4's unknown-actor / unknown-source / unknown-destination
warnings; adds template-preprocessor empty-body and no-mustaches
edges.
* cli — 79.91% → 85.09% — adds hub-output.spec for parseOutputFormat /
printJsonSuccess / printTableSuccess / printError; covers cli-config
loadAuthPlugin error paths; covers diff/timeline ends-with-newline and
non-Error throw branches; covers index.ts entry point including the
catch with Error / non-Error / falsy values; adds
getting-started-url-mapping coverage of the JSON-read catch blocks.
* fix(test): satisfy strict tsc on new flow-sequence specs
The coverage-backfill commit landed new flow-sequence tests that pass
vitest (transpile-only) but fail strict tsc on the tsup-then-tsc build
step:
* `arch.flows[0]` — flows is optional on CalmCoreCanonicalModel; needs
a non-null assertion (`arch.flows![0]`) since makeArch always
populates it.
* The options-kind relationship literal was missing the required
`relationships: []` field on CalmDecisionCanonicalModel.
These are test-only assertions; production types are unchanged. Caught
by every CI job that builds calm-widgets (Shared, CLI, VSCode Ext,
CALM Server, calm-widgets itself).
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matthew Bain <66839492+rocketstack-matt@users.noreply.github.com>1 parent 041246c commit ecc44bf
77 files changed
Lines changed: 2361 additions & 1166 deletions
File tree
- calm-hub-ui/src
- hub/components
- control-detail-section
- diagram-section
- document-detail-section
- interface-detail-section
- visualizer/components/drawer
- calm-models
- src/canonical
- calm-plugins/vscode
- screenshots
- src
- cli
- commands
- create-website
- core/services
- features
- editor/view-model
- preview
- webview
- tree-view/view-model
- validation
- models
- calm-server
- calm-suite/calm-studio
- apps/studio
- src/tests
- io
- packages
- calm-core
- extensions
- github-action
- mcp-server
- vscode-extension
- web-component
- calm-widgets
- src
- widgets
- flow-sequence
- cli/src
- command-helpers
- test_helpers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
| 384 | + | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
| 401 | + | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
15 | 18 | | |
16 | | - | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
| 22 | + | |
19 | 23 | | |
20 | | - | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
| 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 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 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 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
0 commit comments