Feedback use outputLines
This commit is contained in:
parent
32169b7950
commit
fd90424171
|
|
@ -31,6 +31,7 @@ export { countTimes } from '../config/commonFixtures';
|
||||||
type CliRunResult = {
|
type CliRunResult = {
|
||||||
exitCode: number,
|
exitCode: number,
|
||||||
output: string,
|
output: string,
|
||||||
|
outputLines: string[],
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RunResult = {
|
export type RunResult = {
|
||||||
|
|
@ -330,7 +331,12 @@ export const test = base
|
||||||
cwd,
|
cwd,
|
||||||
});
|
});
|
||||||
const { exitCode } = await testProcess.exited;
|
const { exitCode } = await testProcess.exited;
|
||||||
return { exitCode, output: testProcess.output.toString() };
|
const output = testProcess.output.toString();
|
||||||
|
return {
|
||||||
|
exitCode,
|
||||||
|
output,
|
||||||
|
outputLines: parseOutputLines(output),
|
||||||
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -416,6 +422,10 @@ export function expectTestHelper(result: RunResult) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseOutputLines(output: string): string[] {
|
||||||
|
return output.split('\n').filter(line => line.startsWith('%%')).map(line => line.substring(2).trim());
|
||||||
|
}
|
||||||
|
|
||||||
export function parseTestRunnerOutput(output: string) {
|
export function parseTestRunnerOutput(output: string) {
|
||||||
const summary = (re: RegExp) => {
|
const summary = (re: RegExp) => {
|
||||||
let result = 0;
|
let result = 0;
|
||||||
|
|
@ -436,7 +446,7 @@ export function parseTestRunnerOutput(output: string) {
|
||||||
const strippedOutput = stripAnsi(output);
|
const strippedOutput = stripAnsi(output);
|
||||||
return {
|
return {
|
||||||
output: strippedOutput,
|
output: strippedOutput,
|
||||||
outputLines: strippedOutput.split('\n').filter(line => line.startsWith('%%')).map(line => line.substring(2).trim()),
|
outputLines: parseOutputLines(strippedOutput),
|
||||||
rawOutput: output,
|
rawOutput: output,
|
||||||
passed,
|
passed,
|
||||||
failed,
|
failed,
|
||||||
|
|
|
||||||
|
|
@ -1818,7 +1818,7 @@ test('merge reports must not change test ids when there is no need to', async ({
|
||||||
'echo-test-id-reporter.js': `
|
'echo-test-id-reporter.js': `
|
||||||
export default class EchoTestIdReporter {
|
export default class EchoTestIdReporter {
|
||||||
onTestBegin(test) {
|
onTestBegin(test) {
|
||||||
console.log('test.id:', test.id);
|
console.log('%%' + test.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
`,
|
`,
|
||||||
|
|
@ -1859,28 +1859,27 @@ test('merge reports must not change test ids when there is no need to', async ({
|
||||||
let testIdsFromShard1: string[];
|
let testIdsFromShard1: string[];
|
||||||
let testIdsFromShard2: string[];
|
let testIdsFromShard2: string[];
|
||||||
let testIdsFromMergedReport: string[];
|
let testIdsFromMergedReport: string[];
|
||||||
const parseTestIdsFromOutput = (output: string) => output.split('\n').filter(s => s.startsWith('test.id:')).map(s => s.split('test.id:')[1].trim()).sort();
|
|
||||||
{
|
{
|
||||||
const { exitCode, output } = await runInlineTest(files, { workers: 1 }, undefined, { additionalArgs: ['--config', test.info().outputPath('single-run.config.ts')] });
|
const { exitCode, outputLines } = await runInlineTest(files, { workers: 1 }, undefined, { additionalArgs: ['--config', test.info().outputPath('single-run.config.ts')] });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
testIdsFromSingleRun = parseTestIdsFromOutput(output);
|
testIdsFromSingleRun = outputLines.sort();
|
||||||
expect(testIdsFromSingleRun.length).toEqual(3);
|
expect(testIdsFromSingleRun.length).toEqual(3);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const { exitCode, output } = await runInlineTest(files, { workers: 1 }, {}, { additionalArgs: ['--config', test.info().outputPath('shard-1.config.ts')] });
|
const { exitCode, outputLines } = await runInlineTest(files, { workers: 1 }, {}, { additionalArgs: ['--config', test.info().outputPath('shard-1.config.ts')] });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
testIdsFromShard1 = parseTestIdsFromOutput(output);
|
testIdsFromShard1 = outputLines.sort();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const { exitCode, output } = await runInlineTest(files, { workers: 1 }, { PWTEST_BLOB_DO_NOT_REMOVE: '1' }, { additionalArgs: ['--config', test.info().outputPath('shard-2.config.ts')] });
|
const { exitCode, outputLines } = await runInlineTest(files, { workers: 1 }, { PWTEST_BLOB_DO_NOT_REMOVE: '1' }, { additionalArgs: ['--config', test.info().outputPath('shard-2.config.ts')] });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
testIdsFromShard2 = parseTestIdsFromOutput(output);
|
testIdsFromShard2 = outputLines.sort();
|
||||||
expect([...testIdsFromShard1, ...testIdsFromShard2].sort()).toEqual(testIdsFromSingleRun);
|
expect([...testIdsFromShard1, ...testIdsFromShard2].sort()).toEqual(testIdsFromSingleRun);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const { exitCode, output } = await mergeReports(test.info().outputPath('blob-report'), undefined, { additionalArgs: ['--config', test.info().outputPath('merge.config.ts')] });
|
const { exitCode, outputLines } = await mergeReports(test.info().outputPath('blob-report'), undefined, { additionalArgs: ['--config', test.info().outputPath('merge.config.ts')] });
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
testIdsFromMergedReport = parseTestIdsFromOutput(output);
|
testIdsFromMergedReport = outputLines.sort();
|
||||||
expect(testIdsFromMergedReport).toEqual(testIdsFromSingleRun);
|
expect(testIdsFromMergedReport).toEqual(testIdsFromSingleRun);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue