Skip to content

Commit ca314b9

Browse files
authored
use Vitest for test runner (#948)
1 parent e9c1af2 commit ca314b9

16 files changed

+471
-252
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
- run: npm run test:coverage
3535
if: matrix.os == 'macos-12' && matrix.node-version == '18.x'
3636
- uses: codecov/codecov-action@v3
37-
if: matrix.os == 'macos-16' && matrix.node-version == '18.x'
37+
if: matrix.os == 'macos-12' && matrix.node-version == '18.x'

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,26 @@ _Also if this appears in `examples/` feel free to update that, too!_
6262
6363
## Testing
6464
65+
Tests use [Vitest](https://vitest.dev), a modern test-runner based on Jest. To run the tests locally, run:
66+
6567
```
6668
npm test
6769
```
6870
71+
To run an individual test:
72+
73+
```
74+
npx vitest [part of filename]
75+
```
76+
77+
Or to start all tests in watch mode:
78+
79+
```
80+
npx vitest
81+
```
82+
83+
[See docs](https://vitest.dev)
84+
6985
## Help needed
7086
7187
Please check out the [the open issues][issues]. Issues labelled [**Help Wanted**][help-wanted] and [**Good First

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"lint": "eslint .",
4141
"prepare": "npm run build",
4242
"pregenerate": "npm run build",
43-
"test": "mocha --recursive --timeout 30000",
44-
"test:coverage": "nyc --reporter=lcov mocha --recursive --timeout 30000",
43+
"test": "vitest run",
44+
"test:coverage": "vitest run --coverage",
4545
"version": "npm run build"
4646
},
4747
"dependencies": {
@@ -59,14 +59,14 @@
5959
"@types/prettier": "^2.7.1",
6060
"@typescript-eslint/eslint-plugin": "^5.38.1",
6161
"@typescript-eslint/parser": "^5.38.1",
62-
"chai": "^4.3.6",
62+
"@vitest/coverage-c8": "^0.23.4",
6363
"del-cli": "^4.0.1",
6464
"eol": "^0.9.1",
6565
"eslint": "^8.24.0",
6666
"eslint-config-prettier": "^8.5.0",
6767
"eslint-plugin-prettier": "^4.2.1",
68-
"mocha": "^9.2.2",
6968
"nyc": "^15.1.0",
70-
"typescript": "^4.8.4"
69+
"typescript": "^4.8.4",
70+
"vitest": "^0.23.4"
7171
}
7272
}

0 commit comments

Comments
 (0)