Skip to content

Instantly share code, notes, and snippets.

@gauntface
Created March 6, 2017 22:10
Show Gist options
  • Select an option

  • Save gauntface/a37283f071121314b5c657ac5fcd4b26 to your computer and use it in GitHub Desktop.

Select an option

Save gauntface/a37283f071121314b5c657ac5fcd4b26 to your computer and use it in GitHub Desktop.
Wait for message and start mocha test runner.
self.addEventListener('message', (event) => {
if (event.data !== 'run-tests') {
return;
}
const runResults = mocha.run();
runResults.on('end', () => {
event.ports[0].postMessage({
failures: runResults.failures,
total: runResults.total,
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment