Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(docs): replace jest with vitest #5755

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/exercises/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build
coverage
jest.config.js
vitest.config.ts
8 changes: 3 additions & 5 deletions docs/exercises/README.md
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ VxSuite libraries.
## Running the Exercises

To get started, set up the VxSuite repository as usual. Then, in this directory,
run `pnpm test`. This will run the tests for all of the exercises. By default in
watch mode, Jest will not run anything because no files have been changed. You
can use the Jest CLI to run the tests for a specific exercise, e.g.
`pnpm jest --watch 01-iteration/01-toArray.exercise.ts`. I recommend running
with `--watch` so that you can see the tests update as you make changes.
run `pnpm test`. This will run the tests for all of the exercises. You can use
the Vitest CLI to run the tests for a specific exercise, e.g.
`pnpm vitest 01-iteration/01-toArray.exercise.ts`.
9 changes: 0 additions & 9 deletions docs/exercises/jest.config.js

This file was deleted.

13 changes: 5 additions & 8 deletions docs/exercises/package.json
Original file line number Diff line number Diff line change
@@ -11,24 +11,21 @@
"lint:fix": "pnpm type-check && eslint . --fix",
"pre-commit": "lint-staged",
"test": "is-ci test:ci test:watch",
"test:ci": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:ci": "vitest run --coverage",
"test:coverage": "vitest --coverage",
"test:watch": "vitest",
"type-check": "tsc --build"
},
"dependencies": {
"@types/jest": "^29.5.3",
"@types/node": "20.16.0",
"@vitest/coverage-istanbul": "^2.1.8",
"@votingworks/basics": "workspace:*",
"@votingworks/utils": "workspace:*",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "2.2.0",
"jest": "^29.6.2",
"jest-junit": "^16.0.0",
"jest-watch-typeahead": "^2.2.2",
"lint-staged": "11.0.0",
"sort-package-json": "^1.50.0",
"ts-jest": "29.1.1"
"vitest": "^2.1.8"
},
"packageManager": "[email protected]"
}
1 change: 1 addition & 0 deletions docs/exercises/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest';
import { MaybePromise } from '@votingworks/basics';

export function run<I, T extends (input: I) => MaybePromise<unknown>>({
13 changes: 13 additions & 0 deletions docs/exercises/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from '../../vitest.config.shared.mjs';

export default defineConfig({
test: {
include: ['**/*.exercise.ts'],
coverage: {
thresholds: {
lines: 0,
branches: 0,
},
},
},
});
155 changes: 43 additions & 112 deletions pnpm-lock.yaml

Large diffs are not rendered by default.