chore: save test stats (#9138)

This commit is contained in:
Alex Rudenko 2022-10-19 15:21:18 +02:00 committed by GitHub
parent 122778a1f8
commit 3499cbf4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,12 @@ function getApplicableTestSuites(
async function main() { async function main() {
const noCoverage = process.argv.indexOf('--no-coverage') !== -1; const noCoverage = process.argv.indexOf('--no-coverage') !== -1;
const statsFilenameIdx = process.argv.indexOf('--save-stats-to');
let statsFilename = '';
if (statsFilenameIdx !== -1) {
statsFilename = process.argv[statsFilenameIdx + 1] as string;
}
const platform = zPlatform.parse(os.platform()); const platform = zPlatform.parse(os.platform());
const expectations = readJSON( const expectations = readJSON(
@ -85,6 +91,9 @@ async function main() {
const applicableSuites = getApplicableTestSuites(parsedSuitesFile, platform); const applicableSuites = getApplicableTestSuites(parsedSuitesFile, platform);
console.log('Planning to run the following test suites', applicableSuites); console.log('Planning to run the following test suites', applicableSuites);
if (statsFilename) {
console.log('Test stats will be saved to', statsFilename);
}
let fail = false; let fail = false;
const recommendations = []; const recommendations = [];
@ -116,7 +125,9 @@ async function main() {
const tmpDir = fs.mkdtempSync( const tmpDir = fs.mkdtempSync(
path.join(os.tmpdir(), 'puppeteer-test-runner-') path.join(os.tmpdir(), 'puppeteer-test-runner-')
); );
const tmpFilename = path.join(tmpDir, 'output.json'); const tmpFilename = statsFilename
? statsFilename
: path.join(tmpDir, 'output.json');
console.log('Running', JSON.stringify(parameters), tmpFilename); console.log('Running', JSON.stringify(parameters), tmpFilename);
const args = [ const args = [
'-u', '-u',