Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js
diff --git a/node_modules/karma/node_modules/source-map/test/source-map/test-source-node.js b/node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js
similarity index 82%
copy from node_modules/karma/node_modules/source-map/test/source-map/test-source-node.js
copy to node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js
index 139af4e44eba6631eac30a3f11e90e5213d6dc15..d186521ba8b76f0962683ce6f26ff7532729f086 100644
--- a/node_modules/karma/node_modules/source-map/test/source-map/test-source-node.js
+++ b/node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js
@@ -159,7 +159,6 @@ define(function (require, exports, module) {
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
assert.ok(mapWithoutOptions instanceof SourceMapGenerator, 'mapWithoutOptions instanceof SourceMapGenerator');
- assert.ok(!('file' in mapWithoutOptions));
mapWithoutOptions._file = 'foo.js';
util.assertEqualMaps(assert, map.toJSON(), mapWithoutOptions.toJSON());
@@ -277,94 +276,6 @@ define(function (require, exports, module) {
util.assertEqualMaps(assert, map, inputMap);
});
- exports['test .fromStringWithSourceMap() third argument'] = function (assert, util) {
- // Assume the following directory structure:
- //
- // http://foo.org/
- // bar.coffee
- // app/
- // coffee/
- // foo.coffee
- // coffeeBundle.js # Made from {foo,bar,baz}.coffee
- // maps/
- // coffeeBundle.js.map
- // js/
- // foo.js
- // public/
- // app.js # Made from {foo,coffeeBundle}.js
- // app.js.map
- //
- // http://www.example.com/
- // baz.coffee
-
- var coffeeBundle = new SourceNode(1, 0, 'foo.coffee', 'foo(coffee);\n');
- coffeeBundle.setSourceContent('foo.coffee', 'foo coffee');
- coffeeBundle.add(new SourceNode(2, 0, '/bar.coffee', 'bar(coffee);\n'));
- coffeeBundle.add(new SourceNode(3, 0, 'http://www.example.com/baz.coffee', 'baz(coffee);'));
- coffeeBundle = coffeeBundle.toStringWithSourceMap({
- file: 'foo.js',
- sourceRoot: '..'
- });
-
- var foo = new SourceNode(1, 0, 'foo.js', 'foo(js);');
-
- var test = function(relativePath, expectedSources) {
- var app = new SourceNode();
- app.add(SourceNode.fromStringWithSourceMap(
- coffeeBundle.code,
- new SourceMapConsumer(coffeeBundle.map.toString()),
- relativePath));
- app.add(foo);
- var i = 0;
- app.walk(function (chunk, loc) {
- assert.equal(loc.source, expectedSources[i]);
- i++;
- });
- app.walkSourceContents(function (sourceFile, sourceContent) {
- assert.equal(sourceFile, expectedSources[0]);
- assert.equal(sourceContent, 'foo coffee');
- })
- };
-
- test('../coffee/maps', [
- '../coffee/foo.coffee',
- '/bar.coffee',
- 'http://www.example.com/baz.coffee',
- 'foo.js'
- ]);
-
- // If the third parameter is omitted or set to the current working
- // directory we get incorrect source paths:
-
- test(undefined, [
- '../foo.coffee',
- '/bar.coffee',
- 'http://www.example.com/baz.coffee',
- 'foo.js'
- ]);
-
- test('', [
- '../foo.coffee',
- '/bar.coffee',
- 'http://www.example.com/baz.coffee',
- 'foo.js'
- ]);
-
- test('.', [
- '../foo.coffee',
- '/bar.coffee',
- 'http://www.example.com/baz.coffee',
- 'foo.js'
- ]);
-
- test('./', [
- '../foo.coffee',
- '/bar.coffee',
- 'http://www.example.com/baz.coffee',
- 'foo.js'
- ]);
- };
-
exports['test .toStringWithSourceMap() merging duplicate mappings'] = forEachNewline(function (assert, util, nl) {
var input = new SourceNode(null, null, null, [
new SourceNode(1, 0, "a.js", "(function"),
@@ -530,42 +441,6 @@ define(function (require, exports, module) {
assert.equal(result.code, '');
};
- exports['test .toStringWithSourceMap() with consecutive newlines'] = forEachNewline(function (assert, util, nl) {
- var input = new SourceNode(null, null, null, [
- "/***/" + nl + nl,
- new SourceNode(1, 0, "a.js", "'use strict';" + nl),
- new SourceNode(2, 0, "a.js", "a();"),
- ]);
- input = input.toStringWithSourceMap({
- file: 'foo.js'
- });
-
- assert.equal(input.code, [
- "/***/",
- "",
- "'use strict';",
- "a();",
- ].join(nl));
-
- var correctMap = new SourceMapGenerator({
- file: 'foo.js'
- });
- correctMap.addMapping({
- generated: { line: 3, column: 0 },
- source: 'a.js',
- original: { line: 1, column: 0 }
- });
- correctMap.addMapping({
- generated: { line: 4, column: 0 },
- source: 'a.js',
- original: { line: 2, column: 0 }
- });
-
- var inputMap = input.map.toJSON();
- correctMap = correctMap.toJSON();
- util.assertEqualMaps(assert, inputMap, correctMap);
- });
-
exports['test setSourceContent with toStringWithSourceMap'] = function (assert, util) {
var aNode = new SourceNode(1, 1, 'a.js', 'a');
aNode.setSourceContent('a.js', 'someContent');

Powered by Google App Engine
This is Rietveld 408576698