Conversation
- Replace jest with vitest as test runner (~4.3x faster) - Migrate all jest.fn/spyOn/mock/useFakeTimers calls to vi equivalents - Replace @jest-environment with @vitest-environment annotations - Fix constructor mocks to use regular functions instead of vi.fn() - Convert done() callbacks to Promise-based API (Vitest deprecation) - Replace jest.requireActual with synchronous alternatives - Add vitest.config.ts with tsconfig path aliases - Update eslint config to use @vitest/eslint-plugin - Update package.json test scripts Performance comparison (unit tests): Jest: ~57s (2072 tests, 68/69 suites passing) Vitest: ~13s (2078 tests, 69/69 suites passing) Speedup: ~4.3x faster Note: Playwright-based tests (visualization, performance, interactions) are unchanged and continue to use Playwright directly.
…dependencies - Update test scripts in 10 workspace packages from jest to vitest - Remove all Jest devDependencies from root package.json: @alex_neo/jest-expect-message, @types/jest, @types/jest-expect-message, eslint-plugin-jest, jest, jest-environment-jsdom, jest-environment-node, jest-junit, ts-jest - Remove Jest overrides (jest-image-snapshot, jest-environment-node) - Remove Jest deps from @tools/tests and @babylonjs/test-tools - Delete jest.config.ts and jest.visualization.setup.afterEnv.ts - Update vitest.config.ts to use vitest-prefixed setup file names - Update eslint-disable comments from jest/ to vitest/ rules - Add vitest/globals type reference for @tools/test-tools All 2078 tests pass across 69 suites (~13s).
- Remove visualization.utils.ts and visualization.webgl1.test.ts (deprecated Puppeteer/Jest-based tests superseded by Playwright) - Remove scripts/jest-imagediff-reporter.js (Jest custom reporter) - Remove jest-screenshot-report/ from .gitignore Reference images and config files are preserved — they are still used by the Playwright-based visualization tests.
- Remove deprecated deps.moduleDirectories and server.deps.external (invalid in Vitest 4 types, redundant with defaults + vitest.setup.ts) - Add conditional JUnit reporter when CI=true for Azure Pipelines PublishTestResults integration
…to Playwright - Migrate 3 integration test files (sceneLoader, bvhSerializer, glTFSerializer) to use @playwright/test - Migrate 2 performance test files (scene, playgrounds) to use @playwright/test - Add integration project to playwright.utils.ts - Widen performance project glob to include test/performance/**/*.test.ts - Update test:integration script to use Playwright instead of Vitest
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Building or testing the playground has failed. If the tests failed, results can be found here: |
|
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
- Move draco.test.ts from src/ to test/unit/ (was breaking build since @types/jest removed) - Add vitest imports to draco test and use core/* path aliases - Replace globals.jest with vitest globals in ESLint config - Replace jest/* ESLint rules with vitest/* equivalents
- Add 'dom.iterable' to tsconfig.build.json lib (was previously provided transitively by @types/jsdom via Jest/jest-environment-jsdom) - Fix DeepImmutable<FloatArray> cast in thinEngine.setMatrices()
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18136/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18136/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18136/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
Smart Filters Editor is available to test at: |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18136/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18136/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
There was a problem hiding this comment.
Pull request overview
Migrates the repo’s test infrastructure from Jest to Vitest for unit tests and from Puppeteer/Jest to Playwright for browser-based integration/performance tests, along with dependency and tooling cleanup.
Changes:
- Added Vitest configuration/setup and updated package scripts/dependencies to use Vitest for unit tests.
- Migrated integration/performance tests to Playwright and updated Playwright project globs.
- Removed legacy Jest-based utilities/config and updated ESLint/VS Code guidance accordingly.
Reviewed changes
Copilot reviewed 70 out of 73 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vitest.setup.ts | Adds global Vitest setup (module mocking). |
| vitest.config.ts | Introduces Vitest config with TS path alias conversion and per-project unit test config. |
| tsconfig.build.json | Adds dom.iterable to build libs to fix DOM iteration typings. |
| scripts/jest-imagediff-reporter.js | Removes Jest image diff reporter implementation. |
| packages/tools/tests/test/visualization/visualization.webgl1.test.ts | Removes legacy Jest/Puppeteer visualization test entrypoint. |
| packages/tools/tests/test/visualization/visualization.utils.ts | Removes legacy Jest/Puppeteer visualization harness. |
| packages/tools/tests/test/performance/scene.test.ts | Migrates performance tests to Playwright APIs. |
| packages/tools/tests/test/performance/playgrounds.test.ts | Migrates playground performance tests to Playwright APIs. |
| packages/tools/tests/playwright.utils.ts | Expands Playwright performance matching; adds an integration project. |
| packages/tools/tests/package.json | Switches test scripts from Jest to Vitest and removes Jest deps. |
| packages/tools/testTools/tsconfig.build.json | Minor TS config formatting change. |
| packages/tools/testTools/src/vitest.d.ts | Adds Vitest globals type reference. |
| packages/tools/testTools/src/utils.ts | Removes Puppeteer/Jest-specific global declarations. |
| packages/tools/snippetLoader/test/unit/snippetLoader.test.ts | Migrates mocking/spies from Jest to Vitest APIs. |
| packages/tools/snippetLoader/test/unit/saveSnippet.test.ts | Migrates mocks from Jest to Vitest APIs. |
| packages/tools/smartFiltersEditorControl/package.json | Updates test script to Vitest. |
| packages/public/@babylonjs/test-tools/readme.md | Updates docs from Jest/Puppeteer to Playwright and fixes examples. |
| packages/public/@babylonjs/test-tools/package.json | Removes Jest-related dependencies from published package. |
| packages/dev/smartFilters/test/unit/customShaderBlock.test.ts | Migrates jest mocks/clears to Vitest equivalents. |
| packages/dev/smartFilters/package.json | Updates test script to Vitest. |
| packages/dev/smartFilterBlocks/package.json | Updates test script to Vitest. |
| packages/dev/serializers/test/integration/glTFSerializer.test.ts | Migrates integration tests from Jest/Puppeteer to Playwright. |
| packages/dev/serializers/test/integration/bvhSerializer.test.ts | Migrates integration tests from Jest/Puppeteer to Playwright and refactors assertions. |
| packages/dev/lottiePlayer/package.json | Updates test script to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/type nodes.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/objectModel.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/interactivity.math nodes.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/flow nodes.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/event nodes.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/babylon.interactivity.test.ts | Updates spy typing and spy calls to Vitest. |
| packages/dev/loaders/test/unit/Interactivity/animation nodes.test.ts | Migrates spies from Jest to Vitest. |
| packages/dev/loaders/test/integration/babylon.sceneLoader.test.ts | Migrates integration tests from Jest/Puppeteer to Playwright. |
| packages/dev/loaders/package.json | Updates test script to Vitest. |
| packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/metadata/metadataPropertyGridComponent.tsx | Updates TODO wording to remove Jest-specific mention. |
| packages/dev/inspector-v2/package.json | Updates test script to Vitest. |
| packages/dev/gui/package.json | Updates test script to Vitest. |
| packages/dev/core/test/unit/babylon.scene.materials.test.ts | Migrates spies from Jest to Vitest. |
| packages/dev/core/test/unit/XR/webXRFeaturesManager.test.ts | Updates environment pragma to Vitest. |
| packages/dev/core/test/unit/PostProcesses/babylon.postProcess.test.ts | Migrates spy from Jest to Vitest. |
| packages/dev/core/test/unit/Misc/babylon.timer.test.ts | Migrates fake timers API usage to Vitest. |
| packages/dev/core/test/unit/Misc/babylon.coroutine.test.ts | Replaces Jest timeout config with Vitest config. |
| packages/dev/core/test/unit/Misc/babylon.arrayTools.test.ts | Migrates mocks and converts done callback to Promise. |
| packages/dev/core/test/unit/Meshes/babylon.mesh.lod.test.ts | Migrates spy from Jest to Vitest. |
| packages/dev/core/test/unit/Materials/PBR/babylon.PBRMaterial.test.ts | Migrates spies/mocks and updates mock typing. |
| packages/dev/core/test/unit/FlowGraph/flowGraphSerialization.test.ts | Migrates logger mock and removes incorrect jest.mock usage as a value. |
| packages/dev/core/test/unit/FlowGraph/flowGraphExecutionNodes.test.ts | Migrates logger mock to Vitest. |
| packages/dev/core/test/unit/FlowGraph/flowGraphEventNodes.test.ts | Migrates logger mock to Vitest. |
| packages/dev/core/test/unit/FlowGraph/flowGraphDataNodes.test.ts | Migrates logger mock and Math.random spy to Vitest. |
| packages/dev/core/test/unit/DeviceInput/babylon.webDeviceInputSystem.test.ts | Migrates jsdom env pragma and mocks/spies to Vitest. |
| packages/dev/core/test/unit/DeviceInput/babylon.inputManager.test.ts | Migrates jsdom env pragma, fake timers, module mocking to Vitest. |
| packages/dev/core/test/unit/DeviceInput/babylon.deviceInput.test.ts | Migrates module mocking/spies and formatting tweaks. |
| packages/dev/core/test/unit/Culling/babylon.ray.test.ts | Replaces Jest timeout config with Vitest config. |
| packages/dev/core/test/unit/Culling/babylon.octreeBlock.test.ts | Migrates spies from Jest to Vitest. |
| packages/dev/core/test/unit/Cameras/babylon.cameraInputsManager.test.ts | Migrates spies from Jest to Vitest. |
| packages/dev/core/test/unit/Audio/sound.test.ts | Migrates fake timers and mocks to Vitest; preserves real timers for async timeouts. |
| packages/dev/core/test/unit/Audio/helpers/mockedAudioObjects.ts | Migrates extensive Jest mocks to Vitest and rewrites some globals mock wiring. |
| packages/dev/core/test/unit/Audio/helpers/audioTestHelper.ts | Migrates advanceTimersByTime to Vitest. |
| packages/dev/core/test/unit/Audio/audioEngine.test.ts | Migrates fake timers to Vitest and updates env pragma. |
| packages/dev/core/src/Meshes/Compression/test/integration/draco.test.ts | Updates Draco tests to import Vitest APIs and core path aliases. |
| packages/dev/core/src/FlowGraph/serialization.ts | Removes Jest-specific comment. |
| packages/dev/core/src/Engines/thinEngine.ts | Adds Float32List cast for uniformMatrix4fv typing compatibility. |
| packages/dev/core/package.json | Updates test script to Vitest. |
| packages/dev/addons/package.json | Updates test script to Vitest. |
| package.json | Removes Jest deps, adds Vitest deps, and rewires root test scripts to Vitest/Playwright. |
| jest.visualization.setup.afterEnv.ts | Removes Jest visualization after-env setup. |
| jest.config.ts | Removes Jest configuration. |
| eslint.config.mjs | Replaces eslint-plugin-jest with @vitest/eslint-plugin and updates rules. |
| .vscode/launch.json | Updates debugging launch configs from Jest to Vitest/Playwright. |
| .vscode/extensions.json | Removes Jest runner recommendations; keeps Playwright extension. |
| .gitignore | Removes Jest screenshot report ignore entry. |
| .github/instructions/tests.instructions.md | Updates guidance to Vitest for unit tests and Playwright for browser tests. |
| .github/copilot-instructions.md | Updates “Jest tests” wording to “vitest tests”. |
Comments suppressed due to low confidence (2)
packages/public/@babylonjs/test-tools/readme.md:1
- The example references
assetEventLeaks(page)but the surrounding text calls the APIassertEventLeaks. This looks like a typo in the docs and will mislead users copying the snippet; update the example to use the correct function name exported by the package.
vitest.config.ts:1 - The comment says “regex-compatible aliases”, but the implementation is doing simple string trimming (not producing regex-based aliases). Updating the comment to reflect the actual behavior (or implementing true glob/regex handling if that’s required) will reduce confusion for future maintenance.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
|
Building or testing the playground has failed. If the tests failed, results can be found here: |
|
Smart Filters Editor is available to test at: |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18136/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18136/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18136/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
Smart Filters Editor is available to test at: |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18136/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18136/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Smart Filters Editor is available to test at: |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18136/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18136/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
This PR migrates the Babylon.js test infrastructure from Jest to Vitest for unit tests, and migrates Puppeteer/Jest-based integration and performance tests to Playwright.
Motivation
Changes
Unit Tests (Vitest)
vitest.config.tsandvitest.setup.tswith path aliases matching the existing TypeScript configjest.fn()→vi.fn(),jest.spyOn()→vi.spyOn(), etc.)junit.xmloutput whenCI=true)jest.config.ts,jest.visualization.setup.afterEnv.ts, andscripts/jest-imagediff-reporter.jsIntegration Tests (Playwright)
pageglobal to Playwright'stest/expect/Page:packages/dev/loaders/test/integration/babylon.sceneLoader.test.ts(56 tests)packages/dev/serializers/test/integration/bvhSerializer.test.ts(15 tests)packages/dev/serializers/test/integration/glTFSerializer.test.ts(26 tests)integrationproject toplaywright.utils.tstest:integrationscript to use PlaywrightPerformance Tests (Playwright)
packages/tools/tests/test/performance/scene.test.tspackages/tools/tests/test/performance/playgrounds.test.tsperformanceproject glob to match all files undertest/performance/Dependency Cleanup
jest,@types/jest,ts-jest,jest-junit,jest-screenshot,jest-puppeteer,@types/jest-environment-puppeteer,expect-puppeteer,puppeteervitest(^4.1.0)eslint-plugin-vitestinstead ofeslint-plugin-jestpackage.jsontest scriptsVisualization Tests
visualization.utils.ts,visualization.webgl1.test.ts) — these were already superseded by Playwright-based visualization testsDraco Test Relocation
packages/dev/core/src/Meshes/Compression/test/integration/draco.test.tsout ofsrc/topackages/dev/core/test/unit/Meshes/Compression/draco.test.ts.@types/jestglobals were removed.vitestandcore/*path aliases.Removed Legacy Files
Build Type Error Fix:
dom.iterableandFloat32ListRemoving Jest and
jest-environment-jsdomalso removed the transitive dependency on@types/jsdom. That package'sbase.d.tscontained:/// <reference lib="dom.iterable" />This silently injected the
dom.iterablelib into the entire TypeScript build, providing iterator support (Symbol.iterator,for...of) for DOM collection types likeHTMLCollection,NodeListOf, andFileList. Without it, ~50 type errors appeared acrosssharedUiComponents,inspector-v2, andcore.Fix: Added
"dom.iterable"explicitly to thelibarray intsconfig.build.json. This was always a required capability — it was just previously provided as an invisible side effect of a test dependency leaking into the production build.A secondary type error surfaced in
thinEngine.setMatrices(): thematricesparameter typed asDeepImmutable<FloatArray>(which resolves toFloat32Array | ReadonlyArray<number>) became incompatible withFloat32List(which expectsFloat32Array | number[]— mutable). This was masked before because@types/jsdomalso pulled in DOM type variations that affected type resolution. Fix: Added anas Float32Listcast at the call site, which is safe sinceuniformMatrix4fvonly reads the data.Test Results
Scripts Reference
test/test:unittest:visualizationtest:integrationtest:performancetest:interactionsBreaking Changes
None — this is a devDependency-only change. No public APIs are affected.