diff --git a/test/cli/sourcemap-file/_config.js b/test/cli/sourcemap-file/_config.js deleted file mode 100644 index 378f192..0000000 --- a/test/cli/sourcemap-file/_config.js +++ /dev/null @@ -1,6 +0,0 @@ -const assert = require( 'assert' ); - -module.exports = { - description: 'populates file property of sourcemap (#986)', - command: 'rollup -i main.js -o _actual/bundle.js -m' -}; diff --git a/test/cli/sourcemap-file/_expected/bundle.js b/test/cli/sourcemap-file/_expected/bundle.js deleted file mode 100644 index a1c70d0..0000000 --- a/test/cli/sourcemap-file/_expected/bundle.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log( 42 ); -//# sourceMappingURL=bundle.js.map diff --git a/test/cli/sourcemap-file/_expected/bundle.js.map b/test/cli/sourcemap-file/_expected/bundle.js.map deleted file mode 100644 index b36580a..0000000 --- a/test/cli/sourcemap-file/_expected/bundle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC"} diff --git a/test/sourcemaps/sourcemap-file/_config.js b/test/sourcemaps/sourcemap-file/_config.js new file mode 100644 index 0000000..0bfd0b1 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_config.js @@ -0,0 +1,15 @@ +const assert = require( 'assert' ); + +module.exports = { + description: 'populates file property of sourcemap when plugins are used (#986)', + options: { + plugins: [ + { + transform () {} + } + ] + }, + test: ( code, map, profile ) => { + assert.equal( map.file, `bundle.${profile.format}.js` ); + } +}; diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js b/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js new file mode 100644 index 0000000..63fb409 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js @@ -0,0 +1,6 @@ +define(function () { 'use strict'; + +console.log( 42 ); + +}); +//# sourceMappingURL=bundle.amd.js.map diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js.map b/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js.map new file mode 100644 index 0000000..ea2bda6 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.amd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.amd.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,;;"} \ No newline at end of file diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js b/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js new file mode 100644 index 0000000..760e0a5 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js @@ -0,0 +1,4 @@ +'use strict'; + +console.log( 42 ); +//# sourceMappingURL=bundle.cjs.js.map diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js.map b/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js.map new file mode 100644 index 0000000..b947b3d --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC"} \ No newline at end of file diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.es.js b/test/sourcemaps/sourcemap-file/_expected/bundle.es.js new file mode 100644 index 0000000..686daf8 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.es.js @@ -0,0 +1,2 @@ +console.log( 42 ); +//# sourceMappingURL=bundle.es.js.map diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.es.js.map b/test/sourcemaps/sourcemap-file/_expected/bundle.es.js.map new file mode 100644 index 0000000..e835b0a --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.es.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC"} \ No newline at end of file diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js b/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js new file mode 100644 index 0000000..f2c1255 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js @@ -0,0 +1,7 @@ +(function () { +'use strict'; + +console.log( 42 ); + +}()); +//# sourceMappingURL=bundle.iife.js.map diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js.map b/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js.map new file mode 100644 index 0000000..a244e7b --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.iife.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.iife.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;;AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,;;"} \ No newline at end of file diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js b/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js new file mode 100644 index 0000000..4843ebd --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js @@ -0,0 +1,10 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; + +console.log( 42 ); + +}))); +//# sourceMappingURL=bundle.umd.js.map diff --git a/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js.map b/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js.map new file mode 100644 index 0000000..2c8f726 --- /dev/null +++ b/test/sourcemaps/sourcemap-file/_expected/bundle.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.umd.js","sources":["../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;;;;;AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,;;"} \ No newline at end of file diff --git a/test/cli/sourcemap-file/main.js b/test/sourcemaps/sourcemap-file/main.js similarity index 100% rename from test/cli/sourcemap-file/main.js rename to test/sourcemaps/sourcemap-file/main.js diff --git a/test/test.js b/test/test.js index 250b25a..3a0dd82 100644 --- a/test/test.js +++ b/test/test.js @@ -461,7 +461,7 @@ describe( 'rollup', function () { if ( config.test ) { const { code, map } = bundle.generate( options ); - config.test( code, map ); + config.test( code, map, profile ); } if ( config.warnings ) {