Skip to content

Commit db9a797

Browse files
committed
adding mocha-retry for integration tests that can fail from external factors
1 parent 479f66b commit db9a797

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"istanbul": "^0.4.2",
6666
"jsdoc": "^3.4.0",
6767
"mocha": "^2.4.5",
68+
"mocha-retry": "^0.1.0",
6869
"nock": "^7.0.2",
6970
"qs": "^6.1.0",
7071
"wav": "^1.0.0"
@@ -92,8 +93,6 @@
9293
"prepare": "npm test && npm version patch",
9394
"doc": "jsdoc -c jsdoc/config.json",
9495
"watch-doc": "nodemon --watch lib/ --watch services/ --watch jsdoc/ --watch package.json --ext js,tmpl --exec npm run doc",
95-
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --reporter spec --timeout 4000",
96-
"codecov": "istanbul cover ./node_modules/mocha/bin/_mocha && codecov",
97-
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
96+
"codecov": "istanbul cover ./node_modules/.bin/mocha -- --ui mocha-retry && codecov"
9897
}
9998
}

test/test.integration-all-services.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ var TEN_SECONDS = 10000;
1919
var FIVE_SECONDS = 5000;
2020
var TWO_SECONDS = 2000;
2121

22-
describe('integration-all-services', function() {
22+
// for integration tests, we retry up to MAX_RETRIES times and call it a pass if any of them succeed
23+
// because some failures can happen for reasons outside the scope of this package
24+
// see https://www.npmjs.com/package/mocha-retry
25+
var MAX_RETRIES = 3;
26+
27+
describe(MAX_RETRIES, 'integration-all-services', function() {
2328

2429
this.slow(TWO_SECONDS); // this controls when the tests get a colored warning for taking too long
2530

0 commit comments

Comments
 (0)