Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
});
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;
}
};