ci: fix empty retries env var (#11151)
This commit is contained in:
parent
8290dc9de9
commit
eae37d99e9
1
.github/workflows/deflake.yml
vendored
1
.github/workflows/deflake.yml
vendored
@ -37,6 +37,7 @@ on:
|
||||
retries:
|
||||
description: Number of retries per test
|
||||
required: false
|
||||
default: 100
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
|
@ -32,7 +32,11 @@ const skippedTests: Array<{testIdPattern: string; skip: true}> = process.env[
|
||||
? JSON.parse(process.env['PUPPETEER_SKIPPED_TEST_CONFIG'])
|
||||
: [];
|
||||
|
||||
const deflakeRetries = Number(process.env['PUPPETEER_DEFLAKE_RETRIES'] ?? 100);
|
||||
const deflakeRetries = Number(
|
||||
process.env['PUPPETEER_DEFLAKE_RETRIES']
|
||||
? process.env['PUPPETEER_DEFLAKE_RETRIES']
|
||||
: 100
|
||||
);
|
||||
const deflakeTestPattern: string | undefined =
|
||||
process.env['PUPPETEER_DEFLAKE_TESTS'];
|
||||
|
||||
@ -136,10 +140,7 @@ function customBDDInterface(suite: Mocha.Suite) {
|
||||
);
|
||||
if (shouldDeflakeTest(test)) {
|
||||
const deflakeSuit = Mocha.Suite.create(suite, 'with Debug Logs');
|
||||
test.parent = deflakeSuit;
|
||||
deflakeSuit.file = file;
|
||||
deflakeSuit.parent = suite;
|
||||
|
||||
test.file = file;
|
||||
deflakeSuit.beforeEach(function () {
|
||||
setLogCapture(true);
|
||||
});
|
||||
@ -147,7 +148,6 @@ function customBDDInterface(suite: Mocha.Suite) {
|
||||
for (let i = 0; i < deflakeRetries; i++) {
|
||||
deflakeSuit.addTest(test.clone());
|
||||
}
|
||||
|
||||
return test;
|
||||
} else if (!(itOnly || describeOnly) && shouldSkipTest(test)) {
|
||||
const test = new Mocha.Test(title);
|
||||
|
@ -25,7 +25,7 @@ import type {
|
||||
} from './types.js';
|
||||
|
||||
export function extendProcessEnv(envs: object[]): NodeJS.ProcessEnv {
|
||||
return envs.reduce(
|
||||
const env = envs.reduce(
|
||||
(acc: object, item: object) => {
|
||||
Object.assign(acc, item);
|
||||
return acc;
|
||||
@ -33,7 +33,28 @@ export function extendProcessEnv(envs: object[]): NodeJS.ProcessEnv {
|
||||
{
|
||||
...process.env,
|
||||
}
|
||||
) as NodeJS.ProcessEnv;
|
||||
);
|
||||
|
||||
if (process.env['CI']) {
|
||||
const puppeteerEnv = Object.entries(env).reduce(
|
||||
(acc, [key, value]) => {
|
||||
if (key.startsWith('PUPPETEER_')) {
|
||||
acc[key] = value;
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, unknown>
|
||||
);
|
||||
|
||||
console.log(
|
||||
'PUPPETEER env:\n',
|
||||
JSON.stringify(puppeteerEnv, null, 2),
|
||||
'\n'
|
||||
);
|
||||
}
|
||||
|
||||
return env as NodeJS.ProcessEnv;
|
||||
}
|
||||
|
||||
export function getFilename(file: string): string {
|
||||
|
Loading…
Reference in New Issue
Block a user