Skip to content

Commit

Permalink
fix: add timestamp for retries
Browse files Browse the repository at this point in the history
  • Loading branch information
sipayRT committed Jan 17, 2024
1 parent 4c60e7c commit 25d88d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/collector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
});
}

Expand All @@ -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}]
});
}

Expand Down
22 changes: 18 additions & 4 deletions test/lib/collector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
}]
}});
});
});
Expand All @@ -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);
Expand All @@ -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
}]
}});
});
});
Expand Down

0 comments on commit 25d88d7

Please sign in to comment.