-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat: implementing mocha retries #1295
Conversation
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
…js-bigquery into feat_sample_test_retries merging changes from remote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment on how to make retries more granular and efficient.
@@ -36,7 +36,8 @@ const sharedViewId = generateUuid(); | |||
|
|||
const bigquery = new BigQuery(); | |||
|
|||
describe('Authorized View Tutorial', () => { | |||
describe('Authorized View Tutorial', function () { | |||
this.retries(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing this way, it will retry the whole describe
section, which can be quite expensive to re run. I ran some tests here and seems like we can retry on a per spec basis.
describe('Authorized View Tutorial', () => { // Back to arrow function
beforeEach(function(){
console.log("this:", this.currentTest.title)
this.currentTest.retries(2); // will try 3 times - n+1
})
Then I changed one of the tests to fail, to check for the retry behavior:
it('should query stackoverflow', async () => {
const output = execSync('node queryStackOverflow.js');
assert.match(output, /Query Results:/);
assert.match(output, /views/);
assert.match(0,1)
}); // Force failure
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #1299 🦕