Skip to content

Commit

Permalink
Replace Jest with Vitest (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz authored Sep 23, 2024
1 parent 213d802 commit cce1f4b
Show file tree
Hide file tree
Showing 27 changed files with 1,236 additions and 979 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,19 @@ module.exports = {
'n/no-unpublished-require': 'off',
},

overrides: [
{
files: ['**/*.test.js'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022,
},

rules: {
'no-shadow': 'off',
},
},
],

ignorePatterns: ['!.eslintrc.js'],
};
201 changes: 0 additions & 201 deletions jest.config.js

This file was deleted.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint:eslint": "yarn eslint . --ext ts,js",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:config-validation --write",
"lint:misc": "prettier '**/*.json' '!**/rules-snapshot.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore",
"test": "jest"
"test": "vitest"
},
"devDependencies": {
"@eslint/eslintrc": "^3.0.2",
Expand All @@ -27,7 +27,6 @@
"@metamask/eslint-config": "^13.0.0",
"@metamask/eslint-config-nodejs": "^13.0.0",
"@metamask/utils": "^9.1.0",
"@types/jest": "^29.5.12",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import-x": "^0.5.1",
Expand All @@ -37,17 +36,19 @@
"eslint-plugin-prettier": "^4.2.1",
"fast-deep-equal": "^3.1.3",
"globals": "^15.0.0",
"jest": "^29.7.0",
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.18"
"prettier-plugin-packagejson": "^2.2.18",
"vite": "^5.4.7",
"vitest": "^2.1.1"
},
"packageManager": "yarn@3.2.4",
"engines": {
"node": "^18.18 || >=20"
},
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false
"@lavamoat/preinstall-always-fail": false,
"vite>esbuild": true
}
}
}
5 changes: 0 additions & 5 deletions packages/base/jest.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"vitest": "^2.1.1"
},
"peerDependencies": {
"eslint": "^8.57.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/base/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ESLint } = require('eslint');
import { ESLint } from 'eslint';
import { describe, it, expect } from 'vitest';

const config = require('.');
import config from '.';

describe('index', () => {
it('is a valid ESLint config', async () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/browser/jest.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"eslint-plugin-import-x": "^0.5.1",
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"vitest": "^2.1.1"
},
"peerDependencies": {
"@metamask/eslint-config": "^13.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/browser/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ESLint } = require('eslint');
import { ESLint } from 'eslint';
import { describe, it, expect } from 'vitest';

const config = require('.');
import config from '.';

describe('index', () => {
it('is a valid ESLint config', async () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/commonjs/jest.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"eslint-plugin-import-x": "^0.5.1",
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"vitest": "^2.1.1"
},
"peerDependencies": {
"@metamask/eslint-config": "^13.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/commonjs/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ESLint } = require('eslint');
import { ESLint } from 'eslint';
import { describe, it, expect } from 'vitest';

const config = require('.');
import config from '.';

describe('index', () => {
it('is a valid ESLint config', async () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/jest/jest.config.js

This file was deleted.

4 changes: 3 additions & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
"jest": "^29.7.0",
"prettier": "^2.7.1",
"vitest": "^2.1.1"
},
"peerDependencies": {
"@metamask/eslint-config": "^13.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/jest/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ESLint } = require('eslint');
import { ESLint } from 'eslint';
import { describe, it, expect } from 'vitest';

const config = require('.');
import config from '.';

describe('index', () => {
it('is a valid ESLint config', async () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/mocha/jest.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"eslint-plugin-jsdoc": "^47.0.2",
"eslint-plugin-mocha": "^10.4.1",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"vitest": "^2.1.1"
},
"peerDependencies": {
"@metamask/eslint-config": "^13.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/mocha/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { ESLint } = require('eslint');
import { ESLint } from 'eslint';
import { describe, it, expect } from 'vitest';

const config = require('.');
import config from '.';

describe('index', () => {
it('is a valid ESLint config', async () => {
Expand Down
5 changes: 0 additions & 5 deletions packages/nodejs/jest.config.js

This file was deleted.

Loading

0 comments on commit cce1f4b

Please sign in to comment.