@@ -10,6 +10,10 @@ var fs = require('fs');
1010var sourceContent = fs . readFileSync ( join ( __dirname , 'assets/helloworld.js' ) ) . toString ( ) ;
1111
1212
13+ function base64JSON ( object ) {
14+ return 'data:application/json;charset=utf8;base64,' + new Buffer ( JSON . stringify ( object ) ) . toString ( 'base64' ) ;
15+ }
16+
1317function moveHtml ( dest , t ) {
1418 return gulp . src ( join ( __dirname , './assets/*.html' ) )
1519 . pipe ( gulp . dest ( 'tmp/' + dest ) )
@@ -18,7 +22,7 @@ function moveHtml(dest, t){
1822
1923debug ( 'running' ) ;
2024
21- test ( 'creates inline mapping' , function ( t ) {
25+ test ( 'combined: creates inline mapping' , function ( t ) {
2226
2327 gulp . src ( join ( __dirname , './assets/helloworld.js' ) )
2428 . pipe ( sourcemaps . init ( ) )
@@ -42,17 +46,17 @@ test('creates inline mapping', function(t) {
4246 } ) ;
4347} ) ;
4448
45- test ( 'creates re-uses existing mapping ' , function ( t ) {
49+ test ( 'combined: creates preExistingComment , no new previous line ' , function ( t ) {
4650 gulp . src ( join ( __dirname , './assets/helloworld.map.js' ) )
4751 . pipe ( sourcemaps . init ( { loadMaps :true } ) )
4852 . pipe ( sourcemaps . write ( ) )
4953 // .pipe(gulp.dest('tmp'))
5054 . on ( 'data' , function ( data ) {
5155 t . ok ( data . sourceMap , 'should add a source map object' ) ;
52- t . ok ( ! ! data . sourceMap . preExisting , 'should know the sourcemap pre-existed' ) ;
56+ t . ok ( ! ! data . sourceMap . preExistingComment , 'should know the sourcemap pre-existed' ) ;
5357 t . deepEqual (
5458 data . contents . toString ( ) ,
55- sourceContent + " \n//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlcyI6WyJoZWxsb3dvcmxkLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxuZnVuY3Rpb24gaGVsbG9Xb3JsZCgpIHtcbiAgICBjb25zb2xlLmxvZygnSGVsbG8gd29ybGQhJyk7XG59XG4iXSwiZmlsZSI6ImhlbGxvd29ybGQuanMifQ==" ,
59+ sourceContent + ' \n//# sourceMappingURL=' + base64JSON ( data . sourceMap ) + '\n' ,
5660 'file should be sourcemapped'
5761 ) ;
5862 t . end ( ) ;
0 commit comments