Skip to content

Commit 47156d2

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

run-mocha-tests.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Example of running Mocha programmatically
3+
*/
4+
const Mocha = require('mocha');
5+
6+
function runMochaTests() {
7+
return new Promise((resolve, reject) => {
8+
// https://github.com/mochajs/mocha/issues/995
9+
Object.keys( require.cache ).forEach( function( file ) {
10+
delete require.cache[file];
11+
});
12+
const mocha = new Mocha();
13+
mocha.addFile( 'test/WebDriverJs/Mocha/hello-openfin.js' );
14+
mocha.run(resolve);
15+
} );
16+
17+
18+
}
19+
20+
// running the test multiple times
21+
runMochaTests()
22+
.then(runMochaTests)
23+
.then(runMochaTests)
24+
;

0 commit comments

Comments
 (0)