Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case for retries in mocha #221

Merged
merged 1 commit into from
May 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
})
})
})