diff --git a/package.json b/package.json index c5e36bbe1b..98e7946cbd 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "prebuild:watch": "yarn run clean", "build:watch": "tsc -w --strictNullChecks false", "prebuild": "yarn run clean", - "test": "NODE_ENV=test PORT=4243 jest", + "test": "NODE_ENV=test PORT=4243 node --trace-warnings node_modules/.bin/jest", "test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e --testPathIgnorePatterns=dist", "test:docker": "./scripts/docker-postgres.sh", "test:report": "NODE_ENV=test PORT=4243 jest --reporters=\"default\" --reporters=\"jest-junit\"", diff --git a/src/lib/features/feature-toggle/configuration-revision-service.ts b/src/lib/features/feature-toggle/configuration-revision-service.ts index ca9bf072c1..49b11ceeb5 100644 --- a/src/lib/features/feature-toggle/configuration-revision-service.ts +++ b/src/lib/features/feature-toggle/configuration-revision-service.ts @@ -78,4 +78,8 @@ export default class ConfigurationRevisionService extends EventEmitter { return this.revisionId; } + + destroy(): void { + ConfigurationRevisionService.instance?.removeAllListeners(); + } } diff --git a/src/lib/middleware/response-time-metrics.test.ts b/src/lib/middleware/response-time-metrics.test.ts index 38a459f492..d5fe37c556 100644 --- a/src/lib/middleware/response-time-metrics.test.ts +++ b/src/lib/middleware/response-time-metrics.test.ts @@ -52,6 +52,9 @@ describe('responseTimeMetrics old behavior', () => { getAppCountSnapshot: jest.fn(), }; const eventBus = new EventEmitter(); + afterEach(() => { + eventBus.removeAllListeners(); + }); test('uses baseUrl and route path to report metrics', async () => { let timeInfo: any;