Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save gauntface/5384a1631eea66b9e6c97e0df0c93c99 to your computer and use it in GitHub Desktop.
An example of Mocha running in a service worker / web worker.
importScripts('/node_modules/mocha/mocha.js');
mocha.setup({
ui: 'bdd',
reporter: null,
});
describe('First SW Test Suite', function() {
it('should test something', function() {
...
});
});
const runResults = mocha.run();
runResults.on('end', () => {
console.log(`${runResults.failures} out of ${runResults.total} failures.`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment