@@ -8,6 +8,7 @@ var debug = require('debug-fabulous')()(PLUGIN_NAME + ':test:integration');
88var join = require ( 'path' ) . join ;
99var fs = require ( 'fs' ) ;
1010var sourceContent = fs . readFileSync ( join ( __dirname , 'assets/helloworld.js' ) ) . toString ( ) ;
11+ var _ = require ( 'lodash' ) ;
1112
1213
1314function base64JSON ( object ) {
@@ -229,3 +230,31 @@ test('combined: mapped preExisting with two tasks', function(t) {
229230 } ) ;
230231 } ) ;
231232} ) ;
233+
234+ // - thanks @twiggy https://github.com/floridoo/gulp-sourcemaps/issues/270#issuecomment-271723208
235+ test ( 'sources: is valid with concat' , function ( t ) {
236+
237+ gulp . src ( [
238+ join ( __dirname , './assets/test3.js' ) ,
239+ join ( __dirname , './assets/test4.js' ) ,
240+ ] )
241+ . pipe ( sourcemaps . init ( ) )
242+ . pipe ( $ . concat ( "index.js" ) )
243+ . pipe ( sourcemaps . write ( '.' ) )
244+ . pipe ( gulp . dest ( 'tmp/sources_concat' ) )
245+ . on ( 'data' , function ( file ) {
246+ if ( ! / .* \. m a p / . test ( file . path ) ) return ;
247+
248+ var contents = JSON . parse ( file . contents . toString ( ) ) ;
249+ _ . each ( contents . sources , function ( s , i ) {
250+ t . deepEqual ( s , "/test/assets/test" + ( i + 3 ) + ".js" , "source is correct, test" + ( i + 3 ) + ".js" ) ;
251+ } ) ;
252+ } )
253+ . on ( 'error' , function ( ) {
254+ t . fail ( 'emitted error' ) ;
255+ t . end ( ) ;
256+ } ) . on ( 'finish' , function ( ) {
257+ moveHtml ( 'sources_concat' , t ) ;
258+ } ) ;
259+
260+ } ) ;
0 commit comments