Skip to content

Commit

Permalink
Small test inconsequential update
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet committed Jan 16, 2025
1 parent 0eff8a0 commit 5f3ea86
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
3 changes: 0 additions & 3 deletions packages/tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ module.exports = {
clearMocks: true,
globalSetup: '<rootDir>/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: ['<rootDir>/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,
};
62 changes: 30 additions & 32 deletions packages/tests/src/plugins/telemetry/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 5f3ea86

Please sign in to comment.