Skip to content

Commit

Permalink
fix: exit from merge-reports in type: "module" projects (#28725)
Browse files Browse the repository at this point in the history
Fixes #28699
  • Loading branch information
yury-s authored Dec 20, 2023
1 parent b88b194 commit 6d583a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/playwright/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ async function mergeReports(reportDir: string | undefined, opts: { [key: string]
reporterDescriptions = [[defaultReporter]];
const rootDirOverride = configFile ? config.config.rootDir : undefined;
await createMergedReport(config, dir, reporterDescriptions!, rootDirOverride);
gracefullyProcessExitDoNotHang(0);
}

function overridesFromOptions(options: { [key: string]: any }): ConfigCLIOverrides {
Expand Down
17 changes: 17 additions & 0 deletions tests/playwright-test/esm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,3 +672,20 @@ test('should be able to use mergeTests/mergeExpect', async ({ runInlineTest }) =
expect(result.outputLines).toContain('myFixture1: 1');
expect(result.outputLines).toContain('myFixture2: 2');
});

test('should exit after merge-reports', async ({ runInlineTest, mergeReports }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28699' });
const result = await runInlineTest({
'merge.config.ts': `
export default { reporter: 'line' };
`,
'package.json': JSON.stringify({ type: 'module' }),
'nested/folder/a.esm.test.js': `
import { test, expect } from '@playwright/test';
test('test 1', ({}, testInfo) => {});
`
}, undefined, undefined, { additionalArgs: ['--reporter', 'blob'] });
expect(result.exitCode).toBe(0);
const { exitCode } = await mergeReports(test.info().outputPath('blob-report'), undefined, { additionalArgs: ['-c', 'merge.config.ts'] });
expect(exitCode).toBe(0);
});

0 comments on commit 6d583a2

Please sign in to comment.