fix(test runner): dot reporter incorrectly splits by 80 (#7925)

This commit is contained in:
Dmitry Gozman 2021-07-30 01:34:28 -07:00 committed by GitHub
parent 2e387b3a3a
commit 5a3ebfc9f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -23,10 +23,11 @@ class DotReporter extends BaseReporter {
onTestEnd(test: TestCase, result: TestResult) {
super.onTestEnd(test, result);
if (++this._counter === 81) {
if (this._counter === 80) {
process.stdout.write('\n');
return;
this._counter = 0;
}
++this._counter;
if (result.status === 'skipped') {
process.stdout.write(colors.yellow('°'));
return;
@ -37,7 +38,7 @@ class DotReporter extends BaseReporter {
}
switch (test.outcome()) {
case 'expected': process.stdout.write(colors.green('·')); break;
case 'unexpected': process.stdout.write(colors.red(test.results[test.results.length - 1].status === 'timedOut' ? 'T' : 'F')); break;
case 'unexpected': process.stdout.write(colors.red(result.status === 'timedOut' ? 'T' : 'F')); break;
case 'flaky': process.stdout.write(colors.yellow('±')); break;
}
}

View File

@ -90,3 +90,20 @@ test('should work from config', async ({ runInlineTest }) => {
expect(result.output).toContain(colors.green('·'));
expect(result.exitCode).toBe(0);
});
test('render 243 tests in rows by 80', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = pwt;
for (let i = 0; i < 243; i++) {
test('test' + i, () => {});
}
`,
});
expect(result.exitCode).toBe(0);
expect(result.output).toContain(
colors.green('·').repeat(80) + '\n' +
colors.green('·').repeat(80) + '\n' +
colors.green('·').repeat(80) + '\n' +
colors.green('·').repeat(3));
});