From 08c14261d5f089e66e77c819dcd2916ff46122e0 Mon Sep 17 00:00:00 2001 From: Michael Bodnarchuk Date: Sun, 16 Aug 2026 01:14:07 +0300 Subject: [PATCH] Fix the rerunner teardown test failing on main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit explorer.test.ts mocks the codeceptjs module. Bun applies that mock to `codeceptjs/lib/container` as well and keeps it for the rest of the run, so every later test file importing Container gets the fake object. aiTrace.js caches `Container.STANDARD_ACTING_HELPERS` in a module-level const, which was then undefined, and its for-of threw inside Rerunner.setupPlugins() — so the healing wiring test saw zero step.after registrations and failed. It passed in isolation and failed in the suite, because explorer.test.ts sorts before it. Give the fake container the static codeceptjs reads at import time. Co-Authored-By: Claude Opus 5 --- tests/unit/explorer.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unit/explorer.test.ts b/tests/unit/explorer.test.ts index c8240ac5..777f8b34 100644 --- a/tests/unit/explorer.test.ts +++ b/tests/unit/explorer.test.ts @@ -145,6 +145,11 @@ mock.module('codeceptjs', () => { }; const container = { + // Bun applies this mock to `codeceptjs/lib/container` too, and it outlives this + // file: later test files importing Container get this object. Keep the statics + // codeceptjs itself reads at import time — aiTrace.js caches STANDARD_ACTING_HELPERS + // in a module-level const and throws on a for-of over undefined. + STANDARD_ACTING_HELPERS: ['Playwright', 'WebDriver', 'Puppeteer', 'Appium'], create: () => {}, helpers: (name: string) => { if (name === 'Playwright') {