Skip to content

Commit

Permalink
chore: use vitest for tests (#1817)
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito authored Nov 1, 2023
1 parent f6e5112 commit 9e9c5a1
Show file tree
Hide file tree
Showing 112 changed files with 1,104 additions and 1,608 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/02-issue-nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Bug report (Node.js)'
description: I experience unexpected behavior using the library in Node.js (Jest/React Native/Express/etc.).
description: I experience unexpected behavior using the library in Node.js (Vitest/React Native/Express/etc.).
labels: ['bug', 'scope:node', 'needs:triage']
body:
- type: markdown
Expand Down
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Hey! Thank you for deciding to contribute to Mock Service Worker! This page will
Getting yourself familiar with the tools below will substantially ease your contribution experience.

- [TypeScript](https://www.typescriptlang.org/)
- [Jest](https://jestjs.io/)
- [Vitest](https://vitest.dev/)
- [Playwright](https://playwright.dev/)

## Dependencies
Expand Down Expand Up @@ -74,8 +74,6 @@ Build the library with the following command:
$ pnpm build
```

[jest-url]: https://jestjs.io

## Tests

### Testing levels
Expand Down Expand Up @@ -269,6 +267,5 @@ $ pnpm build
```

[pnpm-url]: https://pnpm.io/
[jest-url]: https://jestjs.io
[page-with-url]: https://github.com/kettanaito/page-with
[pnpm-install-guide-url]: https://pnpm.io/7.x/installation#installing-a-specific-version
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ There's no such thing as Service Workers in Node.js. Instead, MSW implements a [

### Usage example

Take a look at the example of an integration test in Jest that uses [React Testing Library](https://github.com/testing-library/react-testing-library) and Mock Service Worker:
Take a look at the example of an integration test in Vitest that uses [React Testing Library](https://github.com/testing-library/react-testing-library) and Mock Service Worker:

```js
// test/Dashboard.test.js
Expand Down
2 changes: 0 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
declare const SERVICE_WORKER_CHECKSUM: string

declare module '@bundled-es-modules/cookie' {
export * as default from 'cookie'
}
Expand Down
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.

31 changes: 0 additions & 31 deletions jest.setup.js

This file was deleted.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@
"start": "tsup --watch",
"clean": "rimraf ./lib",
"lint": "eslint \"{cli,config,src,test}/**/*.ts\"",
"prebuild": "rimraf ./lib",
"build": "pnpm clean && cross-env NODE_ENV=production tsup && pnpm patch:dts",
"patch:dts": "node \"./config/scripts/patch-ts.js\"",
"check:exports": "node \"./config/scripts/validate-esm.js\"",
"test": "pnpm test:unit && pnpm test:node && pnpm test:browser",
"test:unit": "cross-env BABEL_ENV=test jest --maxWorkers=3",
"test:node": "jest --config=./test/jest.config.js --forceExit",
"test:unit": "vitest",
"test:node": "vitest run --config=./test/node/vitest.config.ts",
"test:browser": "playwright test -c ./test/browser/playwright.config.ts",
"test:modules:node": "jest --config=./test/modules/node/jest.config.js",
"test:modules:node": "vitest run --config=./test/modules/node/vitest.config.ts",
"test:modules:browser": "playwright test -c ./test/modules/browser/playwright.config.ts",
"test:ts": "ts-node test/typings/run.ts",
"prepare": "pnpm simple-git-hooks init",
Expand Down Expand Up @@ -143,11 +142,9 @@
"@ossjs/release": "^0.8.0",
"@playwright/test": "^1.30.0",
"@swc/core": "^1.3.35",
"@swc/jest": "^0.2.24",
"@types/express": "^4.17.17",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^8.1.0",
"@types/jest": "^29.4.0",
"@types/json-bigint": "^1.0.1",
"@types/node": "18.x",
"@types/node-fetch": "^2.5.11",
Expand All @@ -170,8 +167,7 @@
"fs-extra": "^10.0.0",
"fs-teardown": "^0.3.0",
"glob": "^9.3.4",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"jsdom": "^22.1.0",
"json-bigint": "^1.0.0",
"lint-staged": "^13.0.3",
"page-with": "^0.6.1",
Expand All @@ -184,6 +180,7 @@
"typescript": "^5.0.2",
"undici": "^5.20.0",
"url-loader": "^4.1.1",
"vitest": "^0.34.6",
"webpack": "^5.68.0",
"webpack-dev-server": "^3.11.2",
"webpack-http-server": "^0.5.0"
Expand Down
Loading

0 comments on commit 9e9c5a1

Please sign in to comment.