From 78df194fc7b38cf051574a4d7c58f9923397de7e Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Fri, 9 Oct 2026 10:37:24 +0200 Subject: [PATCH] test: run documentation script suites in CI Build script bundles before running the Node test suites and verify that the runner invokes each check with the correct flags. Fixes #1413. --- apps/docs/package.json | 2 +- apps/docs/scripts/__tests__/test-runner.test.mjs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/docs/package.json b/apps/docs/package.json index 9607334f8..1351b117e 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -19,7 +19,7 @@ "ci:homepage-performance": "node --test scripts/__tests__/homepage-compiler.test.mjs && node scripts/homepage-performance.mjs", "ci:test": "vitest --run --browser.headless", "ci:test:e2e": "cypress run --config-file cypress.homepage.config.mjs --browser chrome", - "ci:test:scripts": "vitest run --config vitest.scripts.config.mjs", + "ci:test:scripts": "yarn build:scripts && vitest run --config vitest.scripts.config.mjs && node --test scripts/__tests__/generate-llms.test.mjs scripts/__tests__/test-examples.test.mjs scripts/__tests__/test-runner.test.mjs", "ci:test:visual": "VISUAL_TESTS=1 vitest --run --browser.headless", "ci:test:visual:update": "VISUAL_TESTS=1 VISUAL_BASELINE_UPDATE=1 vitest --run --browser.headless --update", "clean:res": "rescript clean", diff --git a/apps/docs/scripts/__tests__/test-runner.test.mjs b/apps/docs/scripts/__tests__/test-runner.test.mjs index 1755c3eb1..d0b16fc7b 100644 --- a/apps/docs/scripts/__tests__/test-runner.test.mjs +++ b/apps/docs/scripts/__tests__/test-runner.test.mjs @@ -17,16 +17,19 @@ test("run routes --update only to test-examples", () => { }, }); - assert.equal(calls.length, 2); + assert.equal(calls.length, 3); assert.equal(calls[0].file, process.execPath); assert.equal(path.basename(calls[0].args[0]), "test-examples.mjs"); assert.deepEqual(calls[0].args.slice(1), ["--update"]); assert.equal(calls[1].file, process.execPath); assert.equal(path.basename(calls[1].args[0]), "test-hrefs.mjs"); assert.deepEqual(calls[1].args.slice(1), []); + assert.equal(calls[2].file, process.execPath); + assert.equal(path.basename(calls[2].args[0]), "test-redirects.mjs"); + assert.deepEqual(calls[2].args.slice(1), []); }); -test("run invokes both scripts without flags by default", () => { +test("run invokes all scripts without flags by default", () => { let calls = []; run({ @@ -39,9 +42,11 @@ test("run invokes both scripts without flags by default", () => { }, }); - assert.equal(calls.length, 2); + assert.equal(calls.length, 3); assert.equal(path.basename(calls[0].args[0]), "test-examples.mjs"); assert.deepEqual(calls[0].args.slice(1), []); assert.equal(path.basename(calls[1].args[0]), "test-hrefs.mjs"); assert.deepEqual(calls[1].args.slice(1), []); + assert.equal(path.basename(calls[2].args[0]), "test-redirects.mjs"); + assert.deepEqual(calls[2].args.slice(1), []); });