diff --git a/packages/tests/jest.config.js b/packages/tests/jest.config.js index 2ad83add8..2b2598680 100644 --- a/packages/tests/jest.config.js +++ b/packages/tests/jest.config.js @@ -7,13 +7,10 @@ module.exports = { clearMocks: true, globalSetup: '/src/_jest/globalSetup.ts', preset: 'ts-jest/presets/js-with-ts', - reporters: [['default', { summaryThreshold: 2 }]], // Without it, vite import is silently crashing the process with code SIGHUP 129 resetModules: true, roots: ['./src/'], setupFilesAfterEnv: ['/src/_jest/setupAfterEnv.ts'], testEnvironment: 'node', testMatch: ['**/*.test.*'], - // We're building a lot of projects in parallel, so we need to increase the timeout. - testTimeout: 20000, }; diff --git a/packages/tests/src/plugins/telemetry/index.test.ts b/packages/tests/src/plugins/telemetry/index.test.ts index 1051fb124..ee80defa6 100644 --- a/packages/tests/src/plugins/telemetry/index.test.ts +++ b/packages/tests/src/plugins/telemetry/index.test.ts @@ -114,41 +114,39 @@ describe('Telemetry Universal Plugin', () => { // We don't want to crash if there are no bundlers to test here. // Which can happen when using --bundlers. - if (expectations.length > 0) { - let cleanup: CleanupFn; - - beforeAll(async () => { - const pluginConfig: Options = { - telemetry: { - enableTracing: true, - endPoint: FAKE_URL, - filters: [], - }, - logLevel: 'warn', - customPlugins: (options: Options, context: GlobalContext) => - debugFilesPlugins(context), - }; - // This one is called at initialization, with the initial context. - addMetricsMocked.mockImplementation(getAddMetricsImplem(metrics)); - cleanup = await runBundlers( - pluginConfig, - getComplexBuildOverrides(), - activeBundlers, - ); - }); + if (!expectations.length) { + return; + } - afterAll(async () => { - await cleanup(); - }); + let cleanup: CleanupFn; - test.each(expectations)( - '$name - $version | Should get the related metrics', - ({ name, expectedMetrics }) => { - const metricNames = metrics[name].map((metric) => metric.metric).sort(); - expect(metricNames).toEqual(expect.arrayContaining(expectedMetrics)); + beforeAll(async () => { + const pluginConfig: Options = { + telemetry: { + enableTracing: true, + endPoint: FAKE_URL, + filters: [], }, - ); - } + logLevel: 'warn', + customPlugins: (options: Options, context: GlobalContext) => + debugFilesPlugins(context), + }; + // This one is called at initialization, with the initial context. + addMetricsMocked.mockImplementation(getAddMetricsImplem(metrics)); + cleanup = await runBundlers(pluginConfig, getComplexBuildOverrides(), activeBundlers); + }); + + afterAll(async () => { + await cleanup(); + }); + + test.each(expectations)( + '$name - $version | Should get the related metrics', + ({ name, expectedMetrics }) => { + const metricNames = metrics[name].map((metric) => metric.metric).sort(); + expect(metricNames).toEqual(expect.arrayContaining(expectedMetrics)); + }, + ); }); describe('Without enableTracing', () => {