From da68fb3d68e10072dce599c3d6e50782ea5670ca Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 20:06:55 +0900 Subject: [PATCH] test: isolate model-error-classifier.test.ts to prevent module mock contamination The test mocks `./connected-providers-cache` at module level, which breaks subsequent tests that import the real module. Move to isolated directory to prevent cross-test contamination. --- commit-msg.txt | 14 ++++++++++++++ commit-msg2.txt | 5 +++++ .../model-error-classifier.test.ts | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 commit-msg.txt create mode 100644 commit-msg2.txt rename src/shared/{ => zauc-mocks-error-classifier}/model-error-classifier.test.ts (98%) diff --git a/commit-msg.txt b/commit-msg.txt new file mode 100644 index 000000000..3cb2debaf --- /dev/null +++ b/commit-msg.txt @@ -0,0 +1,14 @@ +test: isolate mock-contaminating tests into zauc-mocks-* directories + +Bun's `mock.module()` is process-global. Tests that use it permanently +replace the mocked module for all subsequent tests in the same process. +The `mock.restore()` only restores function mocks (spyOn), not module mocks. + +Move the 4 test files causing contamination into isolated subdirectories: +- migrate-legacy-plugin-entry.test.ts (mock.module("node:fs")) +- connected-providers-cache.test.ts (reads cache from filesystem) +- legacy-plugin-warning.test.ts (reads config from filesystem) +- subagent-resolver.test.ts (spies on shared modules) + +This forces bun to run each in a separate process, preventing the +process-global mock contamination that's been causing 68 CI failures. \ No newline at end of file diff --git a/commit-msg2.txt b/commit-msg2.txt new file mode 100644 index 000000000..a27004a05 --- /dev/null +++ b/commit-msg2.txt @@ -0,0 +1,5 @@ +test: isolate model-error-classifier.test.ts to prevent module mock contamination + +The test mocks `./connected-providers-cache` at module level, which breaks +subsequent tests that import the real module. Move to isolated directory +to prevent cross-test contamination. \ No newline at end of file diff --git a/src/shared/model-error-classifier.test.ts b/src/shared/zauc-mocks-error-classifier/model-error-classifier.test.ts similarity index 98% rename from src/shared/model-error-classifier.test.ts rename to src/shared/zauc-mocks-error-classifier/model-error-classifier.test.ts index 60c2572a9..daa5a759f 100644 --- a/src/shared/model-error-classifier.test.ts +++ b/src/shared/zauc-mocks-error-classifier/model-error-classifier.test.ts @@ -4,7 +4,7 @@ const { describe, expect, test, beforeEach, mock, afterAll } = require("bun:test const readConnectedProvidersCacheMock = mock(() => null) async function importFreshModelErrorClassifierModule() { - mock.module("./connected-providers-cache", () => ({ + mock.module("../connected-providers-cache", () => ({ readConnectedProvidersCache: readConnectedProvidersCacheMock, }))