Skip to content

Commit 92f0f40

Browse files
committed
RUN-3179: added run-mocha-tests.js
1 parent 47156d2 commit 92f0f40

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

run-mocha-tests.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const Mocha = require('mocha');
55

66
function runMochaTests() {
77
return new Promise((resolve, reject) => {
8-
// https://github.com/mochajs/mocha/issues/995
8+
// according to https://github.com/mochajs/mocha/issues/995
9+
// "delete require.cache" is needed for running the same test multiple times
910
Object.keys( require.cache ).forEach( function( file ) {
1011
delete require.cache[file];
1112
});
@@ -18,7 +19,9 @@ function runMochaTests() {
1819
}
1920

2021
// running the test multiple times
21-
runMochaTests()
22-
.then(runMochaTests)
23-
.then(runMochaTests)
24-
;
22+
let count = 20;
23+
let pr = runMochaTests();
24+
while (count > 0) {
25+
pr = pr.then(runMochaTests);
26+
count -= 1;
27+
}

0 commit comments

Comments
 (0)