Skip to content

Commit 7ed9c95

Browse files
author
Dominik Zogg
committed
jest => vitest
1 parent 566f3e2 commit 7ed9c95

File tree

6 files changed

+38
-32
lines changed

6 files changed

+38
-32
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
node-version: '16'
2222
- run: npm install
23-
- run: npm test
23+
- run: npm test -- --run --no-cache
2424
node18:
2525
name: Node 18
2626
runs-on: ubuntu-22.04
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
node-version: '18'
3434
- run: npm install
35-
- run: npm test
35+
- run: npm test -- --run --no-cache
3636
node20:
3737
name: Node 20
3838
runs-on: ubuntu-22.04
@@ -46,7 +46,7 @@ jobs:
4646
- run: npm install
4747
- run: npm run lint
4848
- run: npm run cs
49-
- run: npm test -- --coverage --no-cache
49+
- run: npm test -- --run --coverage --no-cache
5050
- run: npm run infection
5151
env:
5252
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

jest.config.cjs

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"repository": "chubbyts/chubbyts-throwable-to-error",
1414
"scripts": {
1515
"build": "node ./build.js",
16-
"cs-fix": "./node_modules/prettier/bin/prettier.cjs --write src tests",
17-
"cs": "./node_modules/prettier/bin/prettier.cjs --check src tests",
16+
"cs-fix": "prettier --write src tests",
17+
"cs": "prettier --check src tests",
1818
"infection": "stryker run",
1919
"lint-fix": "eslint src tests --fix",
2020
"lint": "eslint src tests",
2121
"prepare": "npm run build",
22-
"test": "jest"
22+
"test": "vitest"
2323
},
2424
"prettier": {
2525
"printWidth": 120,
@@ -44,16 +44,14 @@
4444
"dependencies": {},
4545
"devDependencies": {
4646
"@chubbyts/chubbyts-eslint": "^2.0.3",
47-
"@chubbyts/chubbyts-packaging": "^2.0.6",
47+
"@chubbyts/chubbyts-packaging": "^2.0.7",
4848
"@stryker-mutator/core": "^8.2.6",
49-
"@stryker-mutator/jest-runner": "^8.2.6",
50-
"@types/jest": "^29.5.12",
51-
"@types/node": "^20.11.30",
52-
"jest": "^29.7.0",
53-
"prettier": "^3.2.5",
54-
"prettier-2": "npm:prettier@^2.8.8",
55-
"ts-jest": "^29.1.2",
56-
"typescript": "^5.4.3"
49+
"@stryker-mutator/vitest-runner": "^8.2.6",
50+
"@types/node": "^20.14.2",
51+
"@vitest/coverage-v8": "^1.6.0",
52+
"prettier": "^3.3.2",
53+
"typescript": "^5.4.5",
54+
"vitest": "^1.6.0"
5755
},
5856
"publishConfig": {
5957
"access": "public"

stryker.conf.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
3-
"testRunner": "jest",
3+
"testRunner": "vitest",
4+
"vitest": {
5+
"configFile": "vitest.config.ts"
6+
},
47
"coverageAnalysis": "off",
58
"reporters": [
69
"clear-text",

tests/throwable-to-error.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { describe, expect, test } from 'vitest';
12
import { throwableToError } from '../src/throwable-to-error';
23

34
describe('throwableToError', () => {
4-
it('do not convert', () => {
5+
test('do not convert', () => {
56
const error = new Error('example');
67
expect(throwableToError(error)).toBe(error);
78
});

vitest.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
globals: true,
6+
environment: 'node',
7+
include: ['tests/**/*.test.*'],
8+
coverage: {
9+
all: true,
10+
clean: true,
11+
reporter: ['clover', ['html', { subdir: 'html' }], 'json', 'lcovonly', 'text'],
12+
provider: 'v8',
13+
thresholds: {
14+
lines: 100,
15+
},
16+
include: ['src/**/*.ts'],
17+
},
18+
},
19+
});

0 commit comments

Comments
 (0)