Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
56e6067
chore: migrate test runner from Jest to Vitest
FabienMotte Mar 20, 2026
8db375c
chore(create-instantsearch-app): convert source from CJS to ESM
FabienMotte Mar 20, 2026
f76fe0c
chore: remove leftover Jest config and unused vitest environment
FabienMotte Mar 20, 2026
609419f
chore: rename jest references to vitest in comments and paths
FabienMotte Mar 20, 2026
cdd3dbc
chore: remove stale dependencies (jsdom-global, babel-eslint)
FabienMotte Mar 20, 2026
7894531
chore: fix unhandled errors in test suite
FabienMotte Mar 20, 2026
3633440
fix(create-instantsearch-app): preserve CJS require() compatibility
FabienMotte Mar 20, 2026
0cceac9
fix(create-instantsearch-app): support .template.js fallback for cust…
FabienMotte Mar 20, 2026
71ed792
fix(create-instantsearch-app): rename release-templates script to .cjs
FabienMotte Mar 20, 2026
c42c060
test: fix declaration builds for __DEV__ globals
FabienMotte Mar 20, 2026
38d4f15
chore: update Vitest CI worker flags
FabienMotte Mar 20, 2026
05284c4
fix: resolve lint issues from Vitest migration
FabienMotte Mar 20, 2026
c7892ee
fix(types): remove leftover Jasmine type reference that polluted vite…
FabienMotte Mar 21, 2026
b7ef473
fix(tests): restore toMatchNormalizedInlineSnapshot, remove unused to…
FabienMotte Mar 21, 2026
dfde5d9
fix(tests): drop vi.fn() type args for vitest 4 and remove unused imp…
FabienMotte Mar 21, 2026
7322523
fix(tests): import Mock, MockInstance, MockedFunction types from vitest
FabienMotte Mar 21, 2026
7678b2b
fix(tests): fix vitest 4 Mock type params, implicit any, and spread a…
FabienMotte Mar 21, 2026
9320e4c
chore: add vite 8 to root devDependencies for correct type resolution
FabienMotte Mar 21, 2026
5ad5860
fix(tests): fix import order in insights-client-test
FabienMotte Mar 21, 2026
f7a0cd1
fix: normalize widget snapshots before inline assertions
FabienMotte Mar 21, 2026
5dc1397
fix: update CircleCI Vitest command for Vue v3 tests
FabienMotte Mar 21, 2026
8b64ff6
chore: switch Vitest to threads in CI and test runners
FabienMotte Mar 21, 2026
f83d367
test: remove obsolete common widget snapshots
FabienMotte Mar 21, 2026
1cd57d6
fix: remove redundant esbuild config from Vitest
FabienMotte Mar 21, 2026
3733afe
fix: resolve Vue 3 dependencies in Vitest config
FabienMotte Mar 21, 2026
22808e4
fix: repair Vue 3 Vitest prep and snapshots
FabienMotte Mar 21, 2026
4608e89
perf: switch test environment from jsdom to happy-dom
FabienMotte Mar 21, 2026
5fd4f8d
fix: increase test timeout for create-instantsearch-app e2e tests
FabienMotte Mar 22, 2026
06a2051
test: migrate jscodeshift codemod tests to Vitest
FabienMotte Mar 22, 2026
83804b3
fix: correct import order in transforms test
FabienMotte Mar 22, 2026
c44ceb6
fix(types): resolve type errors in codemod tests
FabienMotte Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ jobs:
name: Unit & Integration tests
command: yarn run test:ci:v4
- store_test_results:
path: junit/jest/
path: junit/vitest/
- run:
name: Type Checking
command: yarn run type-check:v4
Expand All @@ -282,9 +282,9 @@ jobs:
yarn run prepare-vue3
- run:
name: Vue Unit tests
command: yarn run jest packages/vue-instantsearch --ci --maxWorkers=4
command: VUE_VERSION=3 yarn vitest run packages/vue-instantsearch --pool=threads --maxWorkers=4
- store_test_results:
path: junit/jest/
path: junit/vitest/
- run:
name: Vue 3 Test Exports
command: yarn workspace vue-instantsearch run test:exports:vue3
Expand All @@ -302,7 +302,7 @@ jobs:
name: Unit tests
command: yarn run test:ci
- store_test_results:
path: junit/jest/
path: junit/vitest/

examples:
<<: *defaults
Expand Down
29 changes: 10 additions & 19 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/**
* Babel configuration for Jest tests only.
* Build transpilation is now handled by SWC via rollup-plugin-swc3.
* Babel configuration for Storybook only.
* Build transpilation is handled by SWC via rollup-plugin-swc3.
* Test transpilation is handled by Vite via Vitest.
*
* @param {Object} api - Babel config API.
* @returns {Object} Babel config.
*/
module.exports = (api) => {
const isStorybook = api.env('storybook');

api.cache(true);

return {
Expand All @@ -16,24 +15,16 @@ module.exports = (api) => {
['@babel/preset-react', { runtime: 'classic' }],
[
'@babel/preset-env',
isStorybook
? {
modules: false,
// Ensure optional chaining/nullish coalescing are transformed
targets: {
ie: 11,
},
}
: {
modules: 'commonjs',
targets: {
node: true,
},
},
{
modules: false,
// Ensure optional chaining/nullish coalescing are transformed
targets: {
ie: 11,
},
},
],
],
plugins: [
// Class properties for test files
'@babel/plugin-proposal-class-properties',
],
};
Expand Down
87 changes: 0 additions & 87 deletions jest.config.js

This file was deleted.

39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"type-check": "tsc && lerna run type-check",
"type-check:v3": "tsc --project tsconfig.v3.json",
"type-check:v4": "tsc --project tsconfig.v4.json",
"test": "jest && lerna run test",
"test:ci": "./scripts/retry.sh 3 'jest --maxWorkers=4 --ci' && lerna run test --concurrency=1",
"test:ci:v4": "./scripts/retry.sh 3 'jest --maxWorkers=4 --ci' && lerna run test:v4 --concurrency=1",
"test": "vitest run && lerna run test",
"test:ci": "./scripts/retry.sh 3 'vitest run --pool=threads --maxWorkers=4' && lerna run test --concurrency=1",
"test:ci:v4": "./scripts/retry.sh 3 'vitest run --pool=threads --maxWorkers=4' && lerna run test:v4 --concurrency=1",
"test:size": "bundlesize",
"test:exports": "lerna run test:exports",
"test:versions": "./tests/versions/index.js",
Expand Down Expand Up @@ -66,23 +66,24 @@
"@swc/core": "1.15.11",
"@swc/helpers": "0.5.18",
"@testing-library/dom": "8.18.1",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/jest-dom": "6",
"@testing-library/preact": "3.2.2",
"@testing-library/react": "16.1.0",
"@testing-library/user-event": "13.5.0",
"@types/enzyme": "^3.1.15",
"@types/googlemaps": "^3.30.16",
"@types/jest": "^27.4.0",
"@types/jest-diff": "^24.3.0",
"@types/jsdom": "16.2.13",
"@types/prop-types": "^15.5.8",
"@types/react": "19.0.3",
"@types/react-dom": "19.0.2",
"@types/react-test-renderer": "19.0.0",
"@types/storybook__addon-actions": "3.4.2",
"@types/storybook__addon-knobs": "^5.0.0",
"@vue/vue2-jest": "27",
"@vue/vue3-jest": "27",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "4.31.2",
"@vitejs/plugin-vue": "6.0.5",
"@vitejs/plugin-vue2": "2.3.4",
"@vitest/coverage-v8": "4.1.0",
"@wdio/cli": "5.16.9",
"@wdio/jasmine-framework": "5.16.5",
"@wdio/junit-reporter": "5.16.11",
Expand All @@ -94,19 +95,20 @@
"algoliasearch": "5.1.1",
"algoliasearch-v3": "npm:algoliasearch@3.35.0",
"algoliasearch-v5": "npm:algoliasearch@5.1.1",
"babel-jest": "27.4.6",
"bundlesize": "0.18.0",
"doctoc": "1.4.0",
"enzyme": "3.11.0",
"eslint": "6.8.0",
"eslint-plugin-import": "2.24.2",
"jest": "27.4.7",
"jest-diff": "27.4.6",
"jest-environment-jsdom": "27.1.0",
"jest-junit": "12.2.0",
"jest-vue-preprocessor": "1.7.1",
"jest-watch-typeahead": "1.0.0",
"jsdom-global": "3.0.2",
"eslint-plugin-jasmine": "4.1.0",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.26.0",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-vitest": "0.5.4",
"eslint-plugin-vue": "9.8.0",
"eslint-plugin-wdio": "5.11.0",
"happy-dom": "20.8.4",
"jsdom": "29.0.0",
"lerna": "6.0.3",
"patch-package": "6.2.2",
"places.js": "1.17.1",
Expand All @@ -120,8 +122,9 @@
"rollup-plugin-swc3": "0.12.1",
"shelljs": "0.8.5",
"shipjs": "0.26.0",
"ts-jest": "27",
"typescript": "5.5.2"
"typescript": "5.5.2",
"vite": "^8.0.1",
"vitest": "4.1.0"
},
"optionalDependencies": {
"oxlint": "1.55.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('fetchConfiguration', () => {
};

// @ts-ignore
global.fetch = jest.fn(() =>
global.fetch = vi.fn(() =>
Promise.resolve({
ok: true,
json: () =>
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('fetchConfiguration', () => {
};

// @ts-ignore
global.fetch = jest.fn(() =>
global.fetch = vi.fn(() =>
Promise.resolve({
ok: true,
json: () =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @jest-environment @instantsearch/testutils/jest-environment-jsdom.ts
* @vitest-environment happy-dom
*/
import { getElements, getSettings } from '../get-information';

Expand Down
6 changes: 3 additions & 3 deletions packages/algolia-experiences/src/__tests__/render.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @jest-environment @instantsearch/testutils/jest-environment-jsdom.ts
* @vitest-environment happy-dom
*/
import {
createMultiSearchResponse,
Expand All @@ -23,7 +23,7 @@ describe('injectStyles', () => {
});

describe('configToIndex', () => {
const error = jest.spyOn(console, 'error').mockImplementation(() => {});
const error = vi.spyOn(console, 'error').mockImplementation(() => {});
beforeEach(() => {
error.mockClear();
});
Expand Down Expand Up @@ -460,7 +460,7 @@ describe('configToIndex', () => {
describe('configure', () => {
it('applies configure widget', async () => {
const searchClient = createSearchClient({
search: jest.fn(() =>
search: vi.fn(() =>
Promise.resolve(
createMultiSearchResponse({
hits: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* @jest-environment @instantsearch/testutils/jest-environment-jsdom.ts
* @vitest-environment happy-dom
*/
import { castToJestMock, wait } from '@instantsearch/testutils';

import { fetchConfiguration } from '../get-configuration';
import { setupInstantSearch } from '../setup-instantsearch';

jest.mock('../get-configuration', () => {
const actual = jest.requireActual('../get-configuration');
vi.mock('../get-configuration', async () => {
const actual = await vi.importActual('../get-configuration');
return {
...actual,
fetchConfiguration: jest.fn(() => Promise.resolve([])),
fetchConfiguration: vi.fn(() => Promise.resolve([])),
};
});

describe('setup of InstantSearch', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
beforeEach(() => {
errorSpy.mockReset();
document.head.innerHTML = '';
Expand Down
10 changes: 0 additions & 10 deletions packages/algoliasearch-helper/jest.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/algoliasearch-helper/jest.setup.js

This file was deleted.

5 changes: 2 additions & 3 deletions packages/algoliasearch-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"doc": "node documentation-src/metalsmith.js",
"test": "../../scripts/retry.sh 3 'scripts/test.sh'",
"test:v4": "../../scripts/retry.sh 3 'scripts/test.sh'",
"test:unit": "jest",
"test:watch": "jest --watch",
"test:unit": "vitest run",
"test:watch": "vitest",
"test:v3": "yarn run test",
"version": "./scripts/update-version.js",
"prepare": "patch-package"
Expand All @@ -37,7 +37,6 @@
"devDependencies": {
"@metalsmith/sass": "1.4.0",
"handlebars": "4.1.0",
"jest-watch-typeahead": "0.3.0",
"jsdoc-to-markdown": "8.0.0",
"metalsmith": "2.5.1",
"metalsmith-in-place": "1.4.4",
Expand Down
Loading
Loading