fix(ci): isolate model-resolver and prometheus-config tests from mock.module contamination
model-resolver.test.ts and prometheus-agent-config-builder.test.ts use
spyOn(shared, 'log') but do not own the logger module. When other test
files in the same bun test process call mock.module('../shared/logger'),
the import cache is poisoned and the spyOn targets a stale binding.
Add a lightweight mock.module call at the top of each file so the
auto-detection in run-ci-tests.ts picks them up as isolated targets.
This ensures each file gets its own module instance and the spy
captures all calls correctly.
Fixes the flaky CI failure pattern where resolveModelWithFallback and
buildPrometheusAgentConfig tests pass locally (separate bun process)
but fail in the shared CI batch.
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { describe, expect, test, spyOn, afterEach, beforeEach } from "bun:test";
|
||||
import { describe, expect, test, spyOn, afterEach, beforeEach, mock } from "bun:test";
|
||||
|
||||
// Isolate from other tests that mock.module the logger (CI cross-contamination fix)
|
||||
mock.module("../shared/logger", () => ({ log: (..._args: unknown[]) => {} }))
|
||||
|
||||
import { buildPrometheusAgentConfig } from "./prometheus-agent-config-builder";
|
||||
import * as shared from "../shared";
|
||||
import * as categoryResolver from "./category-config-resolver";
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { describe, expect, test, spyOn, beforeEach, afterEach, mock } from "bun:test"
|
||||
|
||||
// Isolate from other tests that mock.module the logger (CI cross-contamination fix)
|
||||
mock.module("./logger", () => ({ log: (..._args: unknown[]) => {} }))
|
||||
|
||||
import { resolveModel, resolveModelWithFallback, type ModelResolutionInput, type ExtendedModelResolutionInput, type ModelResolutionResult, type ModelSource } from "./model-resolver"
|
||||
import * as logger from "./logger"
|
||||
import * as connectedProvidersCache from "./connected-providers-cache"
|
||||
|
||||
Reference in New Issue
Block a user