From 63ca9471f58a2dddcbe8368aff0622b0f7384e55 Mon Sep 17 00:00:00 2001 From: Nawid3333 <102778966+Nawid3333@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:25:20 +0100 Subject: [PATCH] chore(test): pnpm test makes the vendored copies first pnpm run verify runs the unit tests before the build, and only the build ran tools/sync-vendor.mjs. vitest.config.mjs points the vendored imports at the npm builds, but in one local checkout that redirect was not called: right after the dependency updates the unit tests ran on the old hls.mjs and 31 failed (hls2mp4) until a build had refreshed it. sync-vendor takes 0.14 s. Co-Authored-By: Claude Opus 5.5 --- package.json | 2 +- tools/sync-vendor.mjs | 2 +- vitest.config.mjs | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8f3638716..eb62d3ef4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "start:ff": "node tools/launch-ff.mjs", "start:ff:fresh": "node tools/launch-ff-fresh.mjs", "start:ff:clean": "web-ext run --source-dir=build_firefox_github --target=firefox-desktop", - "test": "vitest run", + "test": "node tools/sync-vendor.mjs && vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage", "test:workflows": "bash tests/workflows/run.sh", diff --git a/tools/sync-vendor.mjs b/tools/sync-vendor.mjs index 495f4b5ea..4f450cbbf 100644 --- a/tools/sync-vendor.mjs +++ b/tools/sync-vendor.mjs @@ -11,7 +11,7 @@ // so a reviewer can check the base by hash and read the diff in minutes. // // The generated files are gitignored. Run after `pnpm install`, or let -// `pnpm run build` do it. +// `pnpm run build` or `pnpm test` do it. import fs from 'node:fs'; import path from 'node:path'; diff --git a/vitest.config.mjs b/vitest.config.mjs index cacbeeeca..ce28312c1 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -2,8 +2,10 @@ import path from 'node:path'; import {defineConfig} from 'vitest/config'; // Libraries tools/sync-vendor.mjs copies out of node_modules unchanged (patched by pnpm at -// install). The copies are generated, and CI runs the unit tests before it makes them, so a -// test of code that imports one (the save's MP4 writers) gets the npm build itself. +// install). A test of code that imports one (the save's MP4 writers) gets the npm build itself. +// `pnpm test` also makes the copies first: in one local checkout this redirect was not +// called (2026-11-09), and the unit tests there ran on copies from before a dependency +// update (31 failures in hls2mp4 until a build). const root = import.meta.dirname; const VENDORED = new Map([ ['chrome/player/modules/hls.mjs', 'node_modules/hls.js/dist/hls.mjs'],