mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
perf(test): reduce setup overhead; isolate sharp-heavy suites
This commit is contained in:
@@ -15,7 +15,10 @@ const unitIsolatedFiles = [
|
||||
"src/auto-reply/tool-meta.test.ts",
|
||||
"src/auto-reply/envelope.test.ts",
|
||||
"src/commands/auth-choice.test.ts",
|
||||
"src/media/store.test.ts",
|
||||
"src/media/store.header-ext.test.ts",
|
||||
"src/web/media.test.ts",
|
||||
"src/web/auto-reply.web-auto-reply.falls-back-text-media-send-fails.test.ts",
|
||||
"src/browser/server.covers-additional-endpoint-branches.test.ts",
|
||||
"src/browser/server.post-tabs-open-profile-unknown-returns-404.test.ts",
|
||||
"src/browser/server.agent-contract-snapshot-endpoints.test.ts",
|
||||
|
||||
@@ -163,11 +163,18 @@ const createDefaultRegistry = () =>
|
||||
},
|
||||
]);
|
||||
|
||||
// Creating a fresh registry before every single test was measurable overhead.
|
||||
// The registry is treated as immutable by production code; tests that need a
|
||||
// custom registry set it explicitly.
|
||||
const DEFAULT_PLUGIN_REGISTRY = createDefaultRegistry();
|
||||
|
||||
beforeEach(() => {
|
||||
setActivePluginRegistry(createDefaultRegistry());
|
||||
setActivePluginRegistry(DEFAULT_PLUGIN_REGISTRY);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Guard against leaked fake timers across test files/workers.
|
||||
vi.useRealTimers();
|
||||
if (vi.isFakeTimers()) {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user