mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: use intermediate merge report for JSON repoter (#27092)
This commit is contained in:
parent
699e790f69
commit
26cbe69442
@ -128,11 +128,13 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
|||||||
params.reporter = 'blob';
|
params.reporter = 'blob';
|
||||||
}
|
}
|
||||||
const reportFile = path.join(baseDir, 'report.json');
|
const reportFile = path.join(baseDir, 'report.json');
|
||||||
const testProcess = startPlaywrightTest(childProcess, baseDir, params, {
|
// When we have useIntermediateMergeReport, we want the JSON reporter only at the merge step.
|
||||||
|
const envWithJsonReporter = {
|
||||||
PW_TEST_REPORTER: path.join(__dirname, '../../packages/playwright/lib/reporters/json.js'),
|
PW_TEST_REPORTER: path.join(__dirname, '../../packages/playwright/lib/reporters/json.js'),
|
||||||
PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,
|
PLAYWRIGHT_JSON_OUTPUT_NAME: reportFile,
|
||||||
...env,
|
...env,
|
||||||
}, options);
|
};
|
||||||
|
const testProcess = startPlaywrightTest(childProcess, baseDir, params, useIntermediateMergeReport ? env : envWithJsonReporter, options);
|
||||||
const { exitCode } = await testProcess.exited;
|
const { exitCode } = await testProcess.exited;
|
||||||
let output = testProcess.output.toString();
|
let output = testProcess.output.toString();
|
||||||
|
|
||||||
@ -146,7 +148,7 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
|||||||
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
const cwd = options.cwd ? path.resolve(baseDir, options.cwd) : baseDir;
|
||||||
const packageRoot = path.resolve(baseDir, findPackageJSONDir(files, options.cwd ?? ''));
|
const packageRoot = path.resolve(baseDir, findPackageJSONDir(files, options.cwd ?? ''));
|
||||||
const relativeBlobReportPath = path.relative(cwd, path.join(packageRoot, 'blob-report'));
|
const relativeBlobReportPath = path.relative(cwd, path.join(packageRoot, 'blob-report'));
|
||||||
const mergeResult = await mergeReports(relativeBlobReportPath, env, { cwd, additionalArgs });
|
const mergeResult = await mergeReports(relativeBlobReportPath, envWithJsonReporter, { cwd, additionalArgs });
|
||||||
expect(mergeResult.exitCode).toBe(0);
|
expect(mergeResult.exitCode).toBe(0);
|
||||||
output = mergeResult.output;
|
output = mergeResult.output;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user