How to use the source-map-support.mapSourcePosition 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 imodeljs / imodeljs / tools / build / scripts / uitesting / setup-tests.js View on Github external
beforeEach(function () {
  const currentTest = this.currentTest;
  chaiJestSnapshot.configureUsingMochaContext(this);

  // set up snapshot name
  const testFilePath = currentTest.file;
  const sourceFilePath = mapSourcePosition({
    source: testFilePath,
    line: 3,
    column: 1,
  }).source;
  const snapFileName = path.basename(sourceFilePath, path.extname(sourceFilePath)) + ".snap";
  chaiJestSnapshot.setFilename(path.join("tests/.snapshots/", snapFileName));
});
github daviddias / simple-raytracer / node_modules / lab / lib / coverage.js View on Github external
internals.addSourceMapsInformation = function (ret, num) {

    var position = {
        source: ret.filename,
        line: num,
        column: 0
    };
    var originalPosition = sourceMapSupport.mapSourcePosition(position);
    var source = ret.source[num];

    if (position !== originalPosition) {
        source.originalFilename = originalPosition.source.replace(Path.join(process.cwd(), '/').replace(/\\/g, '/'), '');
        source.originalLine = originalPosition.line;

        if (!ret.sourcemaps) {
            ret.sourcemaps = true;
        }
    }
    else {
        source.originalFilename = ret.filename;
        source.originalLine = num;
    }
};

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