From 8fa531fefe58472c0df969158b5e3b0079938a9c Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 25 Sep 2026 20:44:44 +0000 Subject: [PATCH] test(rstest): run the win32 rename mock test in an isolated pool --- docs/local-ci.md | 2 ++ rstest.host-filesystem.config.ts | 3 ++- rstest.integration-tests.ts | 10 ++++++++++ rstest.unit.config.ts | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/local-ci.md b/docs/local-ci.md index 190aa2724..e1b6a268e 100644 --- a/docs/local-ci.md +++ b/docs/local-ci.md @@ -174,6 +174,8 @@ not build the Workbench e2e example payload): - `npm-cli-resolution.test.ts` (Windows official + Unix/nvm + PATH + split-prefix/pnpm `npm_execpath`) - `packed-install-bin.test.ts` (packaged installer bin from a consumer cwd) - `rstest-worker-isolation.test.ts` (canonical TMPDIR; macOS `/tmp` → `/private/tmp`) +- `rstest-generated-module-win32-rename.test.ts` (transient Windows rename retry; + mocks `node:fs/promises`, so it needs this pool's per-file module isolation) That is the slice that can actually diverge by OS. macOS matters because Claude, Codex, and Cursor authors commonly develop there; Windows is in the diff --git a/rstest.host-filesystem.config.ts b/rstest.host-filesystem.config.ts index d0854955a..a7331cc4e 100644 --- a/rstest.host-filesystem.config.ts +++ b/rstest.host-filesystem.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from '@rstest/core'; +import { moduleMockTestFiles } from './rstest.integration-tests.ts'; import { poolTimeouts, processPoolMaxWorkers, @@ -33,7 +34,7 @@ export const hostFilesystemTestFiles = [ export default defineConfig({ extends: withAgentBundleRslibConfig(), - include: [...hostFilesystemTestFiles], + include: [...hostFilesystemTestFiles, ...moduleMockTestFiles], globalSetup: [...workspaceGlobalSetup], pool: { maxWorkers }, setupFiles: [...workspaceSetupFiles], diff --git a/rstest.integration-tests.ts b/rstest.integration-tests.ts index b963a2daf..3eb43e529 100644 --- a/rstest.integration-tests.ts +++ b/rstest.integration-tests.ts @@ -234,3 +234,13 @@ export const templateTestFiles: readonly string[] = [ export const fixtureProjectTestFiles: readonly string[] = [ 'packages/agent-bundle/fixtures/**/tests/**', ]; + +/** + * Files that mock a module with `rs.mock`. The unit pool shares one module + * cache per worker (`isolate: false`), so the mock never reaches a module + * another file in that worker loaded first. They run in the per-file isolated + * `test:host-filesystem` pool instead. + */ +export const moduleMockTestFiles: readonly string[] = [ + 'packages/agent-bundle/tests/rstest-generated-module-win32-rename.test.ts', +]; diff --git a/rstest.unit.config.ts b/rstest.unit.config.ts index b3cbd3a6f..31ec4a51a 100644 --- a/rstest.unit.config.ts +++ b/rstest.unit.config.ts @@ -4,6 +4,7 @@ import { fixtureProjectTestFiles, integrationTestFiles, mcpConformanceTestFiles, + moduleMockTestFiles, nativeHostTestFiles, packedReleaseOnlyTestFiles, packedTestFiles, @@ -30,6 +31,7 @@ export default defineConfig({ ...fixtureProjectTestFiles, ...integrationTestFiles, ...mcpConformanceTestFiles, + ...moduleMockTestFiles, ...nativeHostTestFiles, // Packs and installs like packedTestFiles, and is release-boundary-only: // `test:packed:release` owns it, not the build-free per-PR pool.