From e559f475b509572a0b73da97c234543fc76be345 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Sat, 28 Feb 2015 09:54:29 -0800 Subject: [PATCH] add a test for pull request #43 --- test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test.js b/test.js index 8b3fbf3..f2bf344 100644 --- a/test.js +++ b/test.js @@ -357,3 +357,28 @@ it('sourcesContent', function(done) { /^ at foo \(.*\/original\.js:1002:5\)$/ ]); }); + +it('missing source maps should also be cached', function(done) { + compareStdout(done, createSingleLineSourceMap(), [ + '', + 'var count = 0;', + 'function foo() {', + ' console.log(new Error("this is the error").stack.split("\\n").slice(0, 2).join("\\n"));', + '}', + 'require("./source-map-support").install({', + ' retrieveSourceMap: function(name) {', + ' if (/\\.generated.js$/.test(name)) count++;', + ' return null;', + ' }', + '});', + 'process.nextTick(foo);', + 'process.nextTick(foo);', + 'process.nextTick(function() { console.log(count); });', + ], [ + 'Error: this is the error', + /^ at foo \(.*\/.generated.js:4:15\)$/, + 'Error: this is the error', + /^ at foo \(.*\/.generated.js:4:15\)$/, + '1', // The retrieval should only be attempted once + ]); +});