From 97c615af7aa80be2888dc84229cbb53e7844fdba Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Sun, 1 Nov 2026 10:01:15 +0000 Subject: [PATCH] Describe the scratch-vm test commands for node:test --- docs/contributing/building-running.md | 6 +++--- docs/contributing/testing.md | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/contributing/building-running.md b/docs/contributing/building-running.md index 4c1d72a1..92485a9b 100644 --- a/docs/contributing/building-running.md +++ b/docs/contributing/building-running.md @@ -93,9 +93,9 @@ scratch-vm uses npm and its own scripts: cd scratch-vm npm install npm run lint -npm run tap # all tests -npm run tap:unit # unit tests only -npx tap test/unit/.js # a single file +npm run test:node # all tests +npm run test:unit # unit tests only +node --test test/unit/.js # a single file ``` ### scratch-blocks diff --git a/docs/contributing/testing.md b/docs/contributing/testing.md index a8cacbf9..9ebd802d 100644 --- a/docs/contributing/testing.md +++ b/docs/contributing/testing.md @@ -4,7 +4,7 @@ title: Testing # Testing -MistWarp inherits Scratch's test setup: [Jest](https://jestjs.io/) in scratch-gui and [tap](https://node-tap.io/) in scratch-vm. This page lists the suites and how to run them. +scratch-gui tests run on [Jest](https://jestjs.io/), and scratch-vm tests run on Node's built-in [test runner](https://nodejs.org/api/test.html) with `node:assert`. This page lists the suites and how to run them. ## scratch-gui @@ -74,20 +74,22 @@ The tests need a Chrome and a `chromedriver` of the same major version. `CHROME_ ## scratch-vm -scratch-vm uses tap. From the scratch-vm checkout: +scratch-vm uses `node:test`. From the scratch-vm checkout: ```bash -npm run tap # unit and integration tests -npm run tap:unit # unit tests only -npm run tap:integration -npx tap test/unit/.js # a single file +npm test # lint, then unit and integration tests +npm run test:node # unit and integration tests +npm run test:unit # unit tests only +npm run test:integration # integration tests only +node --test test/unit/.js # a single file +node test/snapshot # compiler snapshot tests ``` The VM is where blocks and the compiler live, so this is the suite to run when changing runtime behavior. When adding or changing a block, add or update a fixture under `test/` so the behavior is pinned. ## What to test -- Changing a block or the compiler: add a scratch-vm tap test. +- Changing a block or the compiler: add a scratch-vm test. - Changing collaboration: run `pnpm run test:collab`. - Changing a React component or container: add a Jest unit test under `test/unit/`. - Anything user-facing that touches the browser: consider an integration test.