mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03: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/tool-meta.test.ts",
|
||||||
"src/auto-reply/envelope.test.ts",
|
"src/auto-reply/envelope.test.ts",
|
||||||
"src/commands/auth-choice.test.ts",
|
"src/commands/auth-choice.test.ts",
|
||||||
|
"src/media/store.test.ts",
|
||||||
"src/media/store.header-ext.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.covers-additional-endpoint-branches.test.ts",
|
||||||
"src/browser/server.post-tabs-open-profile-unknown-returns-404.test.ts",
|
"src/browser/server.post-tabs-open-profile-unknown-returns-404.test.ts",
|
||||||
"src/browser/server.agent-contract-snapshot-endpoints.test.ts",
|
"src/browser/server.agent-contract-snapshot-endpoints.test.ts",
|
||||||
|
|||||||
+9
-2
@@ -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(() => {
|
beforeEach(() => {
|
||||||
setActivePluginRegistry(createDefaultRegistry());
|
setActivePluginRegistry(DEFAULT_PLUGIN_REGISTRY);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
// Guard against leaked fake timers across test files/workers.
|
// Guard against leaked fake timers across test files/workers.
|
||||||
vi.useRealTimers();
|
if (vi.isFakeTimers()) {
|
||||||
|
vi.useRealTimers();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user