chore: added starting time of test to the base json reporter (#16885)
This commit is contained in:
parent
f30ac1d678
commit
409bab59ea
|
|
@ -177,6 +177,7 @@ class JSONReporter implements Reporter {
|
||||||
stderr: result.stderr.map(s => stdioEntry(s)),
|
stderr: result.stderr.map(s => stdioEntry(s)),
|
||||||
retry: result.retry,
|
retry: result.retry,
|
||||||
steps: steps.length ? steps.map(s => this._serializeTestStep(s)) : undefined,
|
steps: steps.length ? steps.map(s => this._serializeTestStep(s)) : undefined,
|
||||||
|
startTime: result.startTime,
|
||||||
attachments: result.attachments.map(a => ({
|
attachments: result.attachments.map(a => ({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
contentType: a.contentType,
|
contentType: a.contentType,
|
||||||
|
|
|
||||||
|
|
@ -493,6 +493,7 @@ export interface JSONReportTestResult {
|
||||||
stderr: JSONReportSTDIOEntry[];
|
stderr: JSONReportSTDIOEntry[];
|
||||||
retry: number;
|
retry: number;
|
||||||
steps?: JSONReportTestStep[];
|
steps?: JSONReportTestStep[];
|
||||||
|
startTime: Date;
|
||||||
attachments: {
|
attachments: {
|
||||||
name: string;
|
name: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
|
|
|
||||||
|
|
@ -235,3 +235,16 @@ test('should add line in addition to file json without CI', async ({ runInlineTe
|
||||||
expect(stripAnsi(result.output)).toContain('[1/1] a.test.js:6:7 › one');
|
expect(stripAnsi(result.output)).toContain('[1/1] a.test.js:6:7 › one');
|
||||||
expect(fs.existsSync(testInfo.outputPath('a.json'))).toBeTruthy();
|
expect(fs.existsSync(testInfo.outputPath('a.json'))).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
test('should have starting time in results', async ({ runInlineTest }, testInfo) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'a.test.js': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('math works!', async ({}) => {
|
||||||
|
expect(1 + 1).toBe(2);
|
||||||
|
});
|
||||||
|
`
|
||||||
|
}, { reporter: 'json' });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
const startTime = result.report.suites[0].specs[0].tests[0].results[0].startTime;
|
||||||
|
expect(new Date(startTime).getTime()).toBeGreaterThan(new Date('1/1/2000').getTime());
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ export interface JSONReportTestResult {
|
||||||
stderr: JSONReportSTDIOEntry[];
|
stderr: JSONReportSTDIOEntry[];
|
||||||
retry: number;
|
retry: number;
|
||||||
steps?: JSONReportTestStep[];
|
steps?: JSONReportTestStep[];
|
||||||
|
startTime: Date;
|
||||||
attachments: {
|
attachments: {
|
||||||
name: string;
|
name: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue