Skip to content

Commit

Permalink
Merge pull request #221 from ipfs/retry-tests
Browse files Browse the repository at this point in the history
Test case for retries in mocha
  • Loading branch information
victorb authored May 3, 2018
2 parents 3ed8611 + 676b1d0 commit 2e2c5b1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,22 @@ describe('test', () => {
Buffer.from('hello') instanceof Uint8Array
).to.eql(true)
})

// Use the following logic for flaky tests!
// Basically, the idea is that we want to retry tests until they succeed or
// reach X number of tries. Important to keep in mind that we should not
// have any globals in these tests and test should be able to be run in total
// isolation (via .only for example)
describe('retrying logic', () => {
let count = 0
it('retries failing tests', function () {
this.retries(4)
count = count + 1
if (count === 2) {
expect(true).to.eql(true)
} else {
expect(false).to.eql(true)
}
})
})
})

0 comments on commit 2e2c5b1

Please sign in to comment.