Commit 6919a8a
committed
test: replace mocha with vitest
Vitest runs tsc's output rather than the TypeScript sources. The injector
discovers dependencies by regex-parsing constructor source text (annotate()
in lib/common/helpers.ts), which only matches tsc's emit; esbuild's class
transform emits constructor(...args), so running the sources directly makes
every injectable fail to resolve.
Test changes required by the runner:
- before/after hooks renamed to beforeAll/afterAll
- 9 promise-chain tests using mocha's done callback converted to async/await
- 25 event-driven done callbacks adapted through withDone(), which wraps a
callback-style body in the promise the runner expects
- the hand-written mocha global typings replaced with vitest/globals
Three failures were pre-existing rather than migration fallout, and are
fixed here because vitest surfaces them where mocha stayed quiet:
- test/options.ts disabled its whole suite with an early return, and
getNSValue in project-data-service generates its cases from an array whose
entries are all commented out; both are now explicit .skip, which is why
the skipped count rises from 9 to 38
- project-name-service only passed because test/project-commands.ts assigns
helpers.isInteractive = () => true in a beforeEach and never restores it,
and mocha's shared module registry leaked that to every file running after
it. Per-file isolation removes the leak, so ensureValidName takes its
non-interactive path and never prompts; the test now pins interactivity
explicitly through setIsInteractive()
- the callstack assertion in errors.ts matched "at next", a mocha runner
frame, and now just requires a stack frame
Same 1513 passing, 22s rather than 31s. Drops istanbul, which nothing
referenced, and dev/tsc-to-mocha-watch.js, which required chalk - not a
declared dependency since it was removed in e562267.1 parent e8e83e4 commit 6919a8a
22 files changed
Lines changed: 2228 additions & 2213 deletions
File tree
- dev
- lib/common/test
- definitions
- unit-tests
- appbuilder
- mobile
- android
- services
- test
- services
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
| 380 | + | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
0 commit comments