fix(test): add afterEach hook to reset global singletons
The test 'should use default maxEvents of 10000' was timing out when run with the full test suite but passed in isolation. Root cause: global singleton instances (WorkerAnalytics, CrossReferenceManager, etc.) retained state across tests in the main 'InMemoryEventStore' describe block. Added afterEach hook that calls all available reset* functions to ensure clean state between tests. Closes: bf-5u6j
This commit is contained in:
parent
15d7915caf
commit
8d75e481c4
1 changed files with 21 additions and 1 deletions
|
|
@ -3,8 +3,18 @@
|
|||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { InMemoryEventStore, getStore, resetStore } from './store.js';
|
||||
import {
|
||||
InMemoryEventStore,
|
||||
getStore,
|
||||
resetStore,
|
||||
} from './store.js';
|
||||
import { LogEvent } from './types.js';
|
||||
import { resetWorkerAnalytics } from './workerAnalytics.js';
|
||||
import { resetCrossReferenceManager } from './crossReferenceManager.js';
|
||||
import { resetHistoricalStore } from './historicalStore.js';
|
||||
import { resetErrorGroupManager } from './errorGrouping.js';
|
||||
import { resetRecoveryManager } from './tui/utils/recoveryPlaybook.js';
|
||||
import { resetCostTracker } from './tui/utils/costTracking.js';
|
||||
|
||||
describe('InMemoryEventStore', () => {
|
||||
let store: InMemoryEventStore;
|
||||
|
|
@ -13,6 +23,16 @@ describe('InMemoryEventStore', () => {
|
|||
store = new InMemoryEventStore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
resetStore();
|
||||
resetWorkerAnalytics();
|
||||
resetCrossReferenceManager();
|
||||
resetHistoricalStore();
|
||||
resetErrorGroupManager();
|
||||
resetRecoveryManager();
|
||||
resetCostTracker();
|
||||
});
|
||||
|
||||
const createEvent = (overrides: Partial<LogEvent> = {}): LogEvent => ({
|
||||
ts: Date.now(),
|
||||
worker: 'w-test',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue