diff --git a/lib/collector/index.js b/lib/collector/index.js index d986021..1ff54d8 100644 --- a/lib/collector/index.js +++ b/lib/collector/index.js @@ -22,12 +22,12 @@ module.exports = class Collector { } addFail(result) { - const {message, stack} = result.err; + const {startTime, duration, err: {message, stack}} = result; this._addTestResult(result, { status: 'fail', errorReason: {message, stack}, - retries: [{message, stack}] + retries: [{message, stack, startTime, duration}] }); } @@ -43,12 +43,12 @@ module.exports = class Collector { } addError(result) { - const {message, stack} = result; + const {message, stack, startTime, duration} = result; this._addTestResult(result, { status: 'error', errorReason: {message, stack}, - retries: [{message, stack}] + retries: [{message, stack, startTime, duration}] }); } diff --git a/test/lib/collector/index.js b/test/lib/collector/index.js index a4393ff..88649a0 100644 --- a/test/lib/collector/index.js +++ b/test/lib/collector/index.js @@ -73,7 +73,7 @@ describe('collector/index', () => { it('should add failed test', () => { const testError = new Promise.OperationalError('test'); - const data = {fullName: 'some name', browserId: 'bro', err: testError}; + const data = {fullName: 'some name', browserId: 'bro', err: testError, startTime: 1000, duration: 500}; const collector = mkCollector_(); collector.addFail(data); @@ -83,8 +83,15 @@ describe('collector/index', () => { fullName: 'some name', browserId: 'bro', status: 'fail', + startTime: data.startTime, + duration: data.duration, errorReason: {message: testError.message, stack: testError.stack}, - retries: [{message: testError.message, stack: testError.stack}] + retries: [{ + message: testError.message, + stack: testError.stack, + startTime: data.startTime, + duration: data.duration + }] }}); }); }); @@ -109,7 +116,7 @@ describe('collector/index', () => { it('should add failed test if the retry fails', () => { const testError = new Promise.OperationalError('test'); - const data = {fullName: 'some name', browserId: 'bro', err: testError}; + const data = {fullName: 'some name', browserId: 'bro', err: testError, startTime: 1000, duration: 500}; const collector = mkCollector_(); collector.addRetry(data); @@ -120,7 +127,14 @@ describe('collector/index', () => { browserId: 'bro', status: 'fail', errorReason: {message: testError.message, stack: testError.stack}, - retries: [{message: testError.message, stack: testError.stack}] + startTime: data.startTime, + duration: data.duration, + retries: [{ + message: testError.message, + stack: testError.stack, + startTime: data.startTime, + duration: data.duration + }] }}); }); });