diff --git a/test/fixtures/normal-file2.js b/test/fixtures/normal-file2.js new file mode 100644 index 0000000..85a6f48 --- /dev/null +++ b/test/fixtures/normal-file2.js @@ -0,0 +1,3 @@ +without SourceMap +anInvalidDirective = "\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"; +// comment diff --git a/test/index.test.js b/test/index.test.js index 1191e24..03a5f1f 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -54,6 +54,17 @@ describe("source-map-loader", function() { }); }); + it("should not process source maps in strings", function(done) { + execLoader(path.join(fixturesPath, "normal-file2.js"), function(err, res, map, deps, warns) { + should.equal(err, null); + warns.should.be.eql([]); + should.equal(res, "without SourceMap\nanInvalidDirective = \"\\n/*# sourceMappingURL=data:application/json;base64,\"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+\" */\";\n// comment"), + should.equal(map, null); + deps.should.be.eql([]); + done(); + }); + }); + it("should process inlined SourceMaps", function(done) { execLoader(path.join(fixturesPath, "inline-source-map.js"), function(err, res, map, deps, warns) { should.equal(err, null); @@ -304,4 +315,4 @@ describe("source-map-loader", function() { } ); }); -}); \ No newline at end of file +});