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.
This commit is contained in:
@@ -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.
|
||||||
@@ -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.
|
||||||
+1
-1
@@ -4,7 +4,7 @@ const { describe, expect, test, beforeEach, mock, afterAll } = require("bun:test
|
|||||||
const readConnectedProvidersCacheMock = mock(() => null)
|
const readConnectedProvidersCacheMock = mock(() => null)
|
||||||
|
|
||||||
async function importFreshModelErrorClassifierModule() {
|
async function importFreshModelErrorClassifierModule() {
|
||||||
mock.module("./connected-providers-cache", () => ({
|
mock.module("../connected-providers-cache", () => ({
|
||||||
readConnectedProvidersCache: readConnectedProvidersCacheMock,
|
readConnectedProvidersCache: readConnectedProvidersCacheMock,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
Reference in New Issue
Block a user