packages/tools/testsMemoryLeaks/README.md
This package contains the Babylon.js memlab-based memory leak runner.
ci: the PR-facing Babylon Server suite. This is the first-class memory-leak suite intended to run on every PR through the root test:memory-leaks entrypoint.extended: additional Babylon Server playground scenarios that are useful locally but increase runtime.packages: deterministic empty.html scenarios for focused bundle and subsystem coverage. The suite currently includes richer @babylonjs/core feature scenes plus @babylonjs/gui, @babylonjs/loaders, @babylonjs/materials, @babylonjs/post-processes, @babylonjs/procedural-textures, and @babylonjs/serializers coverage.
The current coverage includes a combined core feature stack that exercises audio, physics, particles, and navigation, a core rendering stack that exercises render targets, core materials, and shadows, a core texture stack that exercises dynamic textures, raw textures, render targets, and post-process chains, plus fullscreen GUI, mesh-attached GUI, remote glTF loading, direct OBJ/STL loading, materials-library stacks, procedural texture stacks, post-process stacks, and both glTF and GLB export paths.all: every scenario in this package.Package unit tests for the memory leak harness:
npm run test:unit -w @tools/memory-leak-tests
This script runs the package's focused Vitest unit tests through the memory-leak launcher.
Core CI-oriented suite:
npm run test -w @tools/memory-leak-tests
All scenarios:
npm run test:all -w @tools/memory-leak-tests
Package-focused scenarios only:
npm run test:packages -w @tools/memory-leak-tests
List scenarios:
npm run list -w @tools/memory-leak-tests
Run a specific scenario:
npm run test -w @tools/memory-leak-tests -- --scenario core-playground-2FDQT5-1508
The ci and extended suites expect the Babylon server at http://localhost:1337 unless CDN_BASE_URL is set.
In this workspace, the relevant task is:
CDN Serve and watch (Dev) for Babylon Server content.The viewer web component scenario is still available by explicit id, but it is no longer part of the default packages suite because it depends on a separate Vite dev server.
The old runner loaded scenarios through test.html, a start button, a dynamically appended script, and a dispose button that only called LastCreatedEngine.dispose(). That made the browser interaction layer hard to test and easy to race.
The updated runner:
empty.html, which already exposes the Babylon bundles without extra UI state.ci suite because the legacy inspector currently retains a static scene reference after hide(), which would make the PR gate fail for the wrong reason.ci gate.src/scenarios.ts.playground for Babylon Server scenes loaded from Playground snippets.viewer for the viewer custom element test app.package for deterministic package API coverage on empty.html.ci suite.Use the root test:memory-leaks script for the dedicated PR memory-leak gate:
npm run test:memory-leaks
Use the root test:memory-leaks:unit script for the harness unit tests:
npm run test:memory-leaks:unit
In this branch, test:integration also chains into the same ci suite so the memory leak runner is not treated as a one-off local tool.