Skip to content

Commit df3ae9f

Browse files
committed
Switch tester to Vitest
1 parent 8df981a commit df3ae9f

40 files changed

+666
-2092
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ yarn --dev
3737
Each PR should pass the tests and the linter to be accepted.
3838

3939
```bash
40-
# Tests with Jest
40+
# Tests with Vitest
4141
docker pull getmeili/meilisearch:latest # Fetch the latest version of Meilisearch image from Docker Hub
4242
docker run -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=masterKey --no-analytics
4343
# Integration tests

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@
2323
"lint": "turbo lint",
2424
"lint:fix": "turbo lint:fix",
2525
"build": "turbo run build",
26-
"test": "turbo test",
27-
"test:watch": "turbo run test:watch",
28-
"instant-meilisearch:test:watch": "yarn --cwd ./packages/instant-meilisearch test:watch",
29-
"autocomplete:test:watch": "yarn --cwd ./packages/autocomplete-client test:watch",
26+
"test": "vitest run",
27+
"test:watch": "vitest",
28+
"instant-meilisearch:test:watch": "vitest --project \"@meilisearch/instant-meilisearch\"",
29+
"autocomplete:test:watch": "vitest --project \"@meilisearch/autocomplete-client\"",
3030
"test:types": "turbo run test:types",
3131
"version-packages": "changeset version && turbo version",
3232
"release": "yarn build && changeset publish"
3333
},
3434
"devDependencies": {
35+
"vitest": "^3.0.2",
3536
"@testing-library/dom": "^9.2.0",
36-
"@testing-library/jest-dom": "^5.16.5",
37-
"@types/jest": "^29.5.1",
38-
"@types/jest-diff": "^24.3.0",
3937
"parcel": "^2.12.0",
4038
"turbo": "^2.1.3"
4139
},

packages/autocomplete-client/jest.config.js

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

packages/autocomplete-client/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"access": "public"
99
},
1010
"scripts": {
11-
"clear_jest": "jest --clearCache",
1211
"cleanup": "shx rm -rf dist/",
13-
"test:watch": "yarn test --watchAll",
14-
"test": "jest --runInBand --selectProjects dom --selectProjects node",
1512
"build": "yarn cleanup && rollup -c rollup.config.js && rollup --environment NODE_ENV:production -c rollup.config.js",
1613
"dev": "rollup -c rollup.config.js --watch",
1714
"lint": "eslint --ext .js,.ts,.tsx .",
@@ -56,22 +53,17 @@
5653
"@babel/preset-env": "^7.20.2",
5754
"@rollup/plugin-commonjs": "^17.1.0",
5855
"@rollup/plugin-node-resolve": "^11.2.0",
59-
"@types/jest": "^27.0.2",
60-
"babel-jest": "^27.2.2",
6156
"concurrently": "^7.1.0",
6257
"cssnano": "^4.1.10",
6358
"eslint-config-meilisearch": "*",
6459
"instantsearch.js": "^4.56.2",
65-
"jest": "^27.2.2",
66-
"jest-watch-typeahead": "^0.6.3",
6760
"regenerator-runtime": "^0.13.7",
6861
"rollup": "^2.79.2",
6962
"rollup-plugin-babel": "^4.4.0",
7063
"rollup-plugin-node-polyfills": "^0.2.1",
7164
"rollup-plugin-terser": "^7.0.0",
7265
"rollup-plugin-typescript2": "^0.32.1",
7366
"shx": "^0.3.4",
74-
"ts-jest": "^27.0.7",
7567
"tslib": "^2.6.1",
7668
"typescript": "^4.9.3"
7769
}

packages/autocomplete-client/src/requesters/__tests__/getmeilisearchResults.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, test, expect } from 'vitest'
12
import { getMeilisearchResults } from '../'
23
import { searchClient } from '../../../__tests__/test.utils'
34

packages/autocomplete-client/src/search/__tests__/fetchMeilisearchResults.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, beforeAll, test, expect, afterAll } from 'vitest'
12
import { fetchMeilisearchResults } from '../fetchMeilisearchResults'
23
import {
34
searchClient,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineProject } from 'vitest/config'
2+
3+
export default defineProject({
4+
test: {
5+
include: ['{src,__tests__}/**/*.test.ts'],
6+
testTimeout: 100_000, // 100 seconds
7+
},
8+
})

packages/eslint-config-meilisearch/index.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = {
1212
commonjs: true, // Needed to avoid import is reserved error
1313
node: true,
1414
browser: true,
15-
jest: true,
1615
},
1716
parser: 'babel-eslint',
1817
extends: [
@@ -46,25 +45,18 @@ module.exports = {
4645
env: {
4746
browser: true,
4847
es2020: true,
49-
'jest/globals': true,
5048
node: true,
51-
jasmine: true,
5249
},
5350
globals: {
5451
instantsearch: true,
5552
instantMeiliSearch: true,
56-
page: true, // for jest/puppeteer tests in tests/env/express
57-
browser: true, // for jest/puppeteer tests in tests/env/express
58-
context: true, // for jest/puppeteer tests in tests/env/express
59-
jestPuppeteer: true, // for jest/puppeteer tests in tests/env/express
6053
},
6154
extends: [
6255
'standard',
6356
'plugin:prettier/recommended',
6457
'eslint:recommended',
6558
'plugin:cypress/recommended',
6659
],
67-
plugins: ['jest'],
6860
parserOptions: {
6961
ecmaVersion: 2020,
7062
},
@@ -111,14 +103,6 @@ module.exports = {
111103
env: {
112104
browser: true,
113105
es2020: true,
114-
'jest/globals': true,
115-
jasmine: true,
116-
},
117-
globals: {
118-
page: true, // for jest/puppeteer tests in tests/env/express
119-
browser: true, // for jest/puppeteer tests in tests/env/express
120-
context: true, // for jest/puppeteer tests in tests/env/express
121-
jestPuppeteer: true, // for jest/puppeteer tests in tests/env/express
122106
},
123107
extends: [
124108
'standard',
@@ -134,7 +118,7 @@ module.exports = {
134118
projectFolderIgnoreList: ['dist'],
135119
},
136120

137-
plugins: ['jsdoc', '@typescript-eslint', 'jest'],
121+
plugins: ['jsdoc', '@typescript-eslint'],
138122
rules: {
139123
'@typescript-eslint/no-empty-interface': 'off', // Due to vue-instantsearch not having typings
140124
'no-dupe-class-members': 'off', // Off due to conflict with typescript overload functions

packages/eslint-config-meilisearch/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"eslint-config-standard": "^17.0.0",
1919
"eslint-plugin-cypress": "^2.11.3",
2020
"eslint-plugin-import": "^2.27.5",
21-
"eslint-plugin-jest": "^24.1.5",
2221
"eslint-plugin-jsdoc": "^32.2.0",
2322
"eslint-plugin-n": "^15.6.1",
2423
"eslint-plugin-prettier": "^4.2.1",

packages/instant-meilisearch/__tests__/configure.attributes-to-retrieve.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, beforeAll, test, expect } from 'vitest'
12
import {
23
searchClient,
34
dataset,

0 commit comments

Comments
 (0)