fix(reporter): line reporter should not swallow half-line stdout (#15114)
This commit is contained in:
parent
d152f7957a
commit
a93db3cf11
|
|
@ -56,6 +56,9 @@ class LineReporter extends BaseReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.write(chunk);
|
stream.write(chunk);
|
||||||
|
if (chunk[chunk.length - 1] !== '\n')
|
||||||
|
console.log();
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,3 +82,25 @@ test('should work on CI', async ({ runInlineTest }) => {
|
||||||
expect(text).toContain('1) a.test');
|
expect(text).toContain('1) a.test');
|
||||||
expect(result.exitCode).toBe(1);
|
expect(result.exitCode).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should print output', async ({ runInlineTest }) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'a.spec.ts': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('foobar', async ({}, testInfo) => {
|
||||||
|
process.stdout.write('one');
|
||||||
|
process.stdout.write('two');
|
||||||
|
console.log('full-line');
|
||||||
|
});
|
||||||
|
`
|
||||||
|
}, { reporter: 'line' });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(stripAnsi(result.output)).toContain([
|
||||||
|
'a.spec.ts:6:7 › foobar',
|
||||||
|
'one',
|
||||||
|
'',
|
||||||
|
'two',
|
||||||
|
'',
|
||||||
|
'full-line',
|
||||||
|
].join('\n'));
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue