mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-12-12 09:52:37 +00:00
[tests] migrate from jest to vitest (#3940)
This is a big change, but I think it's a good move, as `vitest` is much more modern than `jest`. I'm excited about the UI watch feature (run `npm run test:ui`), for example - it's really helpful and saves time when debugging tests. I had to adjust a few tests because they had time related issues, but basically we are now testing the same things - even a bit better and less flaky (I hope). What do you think?
This commit is contained in:
committed by
GitHub
parent
b542f33a0a
commit
462abf7027
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
@@ -30,9 +30,19 @@ To run markdownlint, use `node --run lint:markdown`.
|
||||
|
||||
## Testing
|
||||
|
||||
We use [Jest](https://jestjs.io) for JavaScript testing.
|
||||
We use [Vitest](https://vitest.dev) for JavaScript testing.
|
||||
|
||||
To run all tests, use `node --run test`.
|
||||
|
||||
The specific test commands are defined in `package.json`.
|
||||
So you can also run the specific tests with other commands, e.g. `node --run test:unit` or `npx jest tests/e2e/env_spec.js`.
|
||||
The `package.json` scripts expose finer-grained test commands:
|
||||
|
||||
- `test:unit` – run unit tests only
|
||||
- `test:e2e` – execute browser-driven end-to-end tests
|
||||
- `test:electron` – launch the Electron-based regression suite
|
||||
- `test:coverage` – collect coverage while running every suite
|
||||
- `test:watch` – keep Vitest in watch mode for fast local feedback
|
||||
- `test:ui` – open the Vitest UI dashboard (needs OS file-watch support enabled)
|
||||
- `test:calendar` – run the legacy calendar debug helper
|
||||
- `test:css`, `test:markdown`, `test:prettier`, `test:spelling`, `test:js` – lint-only scripts that enforce formatting, spelling, markdown style, and ESLint.
|
||||
|
||||
You can invoke any script with `node --run <script>` (or `npm run <script>`). Individual files can still be targeted directly, e.g. `npx vitest run tests/e2e/env_spec.js`.
|
||||
|
||||
Reference in New Issue
Block a user