How to use the source-map-support/sw-source-map-support.install function in source-map-support

To help you get started, we’ve selected a few source-map-support examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github service-mocker / service-mocker / test / runner / server-runner.js View on Github external
export function serverRunner(register) {
  // register tests right away on legacy mode
  if (server.isLegacy) {
    return register();
  }

  // wrap `self.onerror`,
  // remove the annoying warning caused by mocha
  wrapErrorEvent();

  // avoid polluting client env
  require('mocha/mocha');
  require('source-map-support/sw-source-map-support').install();

  // wait for client request on modern mode
  // DON'T use `server.on()`, this listener should be permanently added
  self.addEventListener('message', (evt) => {
    const {
      data,
      ports,
    } = evt;

    if (data && data.request === 'MOCHA_TASKS') {
      ports[0].postMessage({
        suites: runTests(register),
      });
    }
  });
}

source-map-support

Fixes stack traces for files with source maps

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages