fix: exit from merge-reports in type: "module" projects (#28725)

Fixes https://github.com/microsoft/playwright/issues/28699
This commit is contained in:
Yury Semikhatsky 2023-12-19 16:49:25 -08:00 committed by GitHub
parent b88b194e9f
commit 6d583a2dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -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 {

View File

@ -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);
});