@@ -79,79 +79,6 @@ describe('add', function() {
79
79
} ) ;
80
80
} ) ;
81
81
82
- describe ( 'ensures options argument' , function ( ) {
83
-
84
- // Currently no options are defaulted
85
- // TODO: Enable test if any options are defaulted
86
- it . skip ( 'is not mutated' , function ( done ) {
87
- var defaultedOpts = { } ;
88
-
89
- var opts = { } ;
90
-
91
- var file = makeFile ( ) ;
92
- sourcemaps . add ( file , opts , function ( err ) {
93
- expect ( opts ) . toNotEqual ( defaultedOpts ) ;
94
- done ( err ) ;
95
- } ) ;
96
- } ) ;
97
-
98
- it ( 'is defaulted if undefined' , function ( done ) {
99
- var file = makeFile ( ) ;
100
- sourcemaps . add ( file , undefined , function ( err ) {
101
- expect ( err ) . toNotExist ( ) ;
102
- done ( ) ;
103
- } ) ;
104
- } ) ;
105
-
106
- it ( 'is defaulted if null' , function ( done ) {
107
- var file = makeFile ( ) ;
108
- sourcemaps . add ( file , null , function ( err ) {
109
- expect ( err ) . toNotExist ( ) ;
110
- done ( ) ;
111
- } ) ;
112
- } ) ;
113
-
114
- it ( 'is defaulted if empty string' , function ( done ) {
115
- var file = makeFile ( ) ;
116
- sourcemaps . add ( file , '' , function ( err ) {
117
- expect ( err ) . toNotExist ( ) ;
118
- done ( ) ;
119
- } ) ;
120
- } ) ;
121
-
122
- it ( 'is defaulted if non-empty string' , function ( done ) {
123
- var file = makeFile ( ) ;
124
- sourcemaps . add ( file , 'invalid' , function ( err ) {
125
- expect ( err ) . toNotExist ( ) ;
126
- done ( ) ;
127
- } ) ;
128
- } ) ;
129
-
130
- it ( 'is defaulted if boolean false' , function ( done ) {
131
- var file = makeFile ( ) ;
132
- sourcemaps . add ( file , false , function ( err ) {
133
- expect ( err ) . toNotExist ( ) ;
134
- done ( ) ;
135
- } ) ;
136
- } ) ;
137
-
138
- it ( 'is defaulted if boolean true' , function ( done ) {
139
- var file = makeFile ( ) ;
140
- sourcemaps . add ( file , true , function ( err ) {
141
- expect ( err ) . toNotExist ( ) ;
142
- done ( ) ;
143
- } ) ;
144
- } ) ;
145
-
146
- it ( 'is defaulted if array' , function ( done ) {
147
- var file = makeFile ( ) ;
148
- sourcemaps . add ( file , [ ] , function ( err ) {
149
- expect ( err ) . toNotExist ( ) ;
150
- done ( ) ;
151
- } ) ;
152
- } ) ;
153
- } ) ;
154
-
155
82
it ( 'should add an empty sourceMap' , function ( done ) {
156
83
sourcemaps . add ( makeFile ( ) , function ( err , data ) {
157
84
expect ( File . isVinyl ( data ) ) . toExist ( ) ;
@@ -166,7 +93,7 @@ describe('add', function() {
166
93
} ) ;
167
94
168
95
it ( 'should import an existing inline source map' , function ( done ) {
169
- sourcemaps . add ( makeFileWithInlineSourceMap ( ) , { loadMaps : true } , function ( err , data ) {
96
+ sourcemaps . add ( makeFileWithInlineSourceMap ( ) , function ( err , data ) {
170
97
expect ( data ) . toExist ( ) ;
171
98
expect ( data instanceof File ) . toExist ( ) ;
172
99
expect ( data . sourceMap ) . toExist ( ) ;
@@ -179,7 +106,7 @@ describe('add', function() {
179
106
} ) ;
180
107
181
108
it ( 'should remove inline source' , function ( done ) {
182
- sourcemaps . add ( makeFileWithInlineSourceMap ( ) , { loadMaps : true } , function ( err , data ) {
109
+ sourcemaps . add ( makeFileWithInlineSourceMap ( ) , function ( err , data ) {
183
110
expect ( / s o u r c e M a p p i n g U R L / . test ( data . contents . toString ( ) ) ) . toNotExist ( ) ;
184
111
done ( err ) ;
185
112
} ) ;
@@ -188,7 +115,7 @@ describe('add', function() {
188
115
it ( 'should load external source map file reference in comment with \/\/# syntax' , function ( done ) {
189
116
var file = makeFile ( ) ;
190
117
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld2.js.map' ) ;
191
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
118
+ sourcemaps . add ( file , function ( err , data ) {
192
119
expect ( data . sourceMap ) . toExist ( ) ;
193
120
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
194
121
expect ( data . sourceMap . sources ) . toEqual ( [ 'helloworld2.js' ] ) ;
@@ -201,7 +128,7 @@ describe('add', function() {
201
128
it ( 'should remove source map comment with the \/\/# syntax' , function ( done ) {
202
129
var file = makeFile ( ) ;
203
130
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld2.js.map' ) ;
204
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
131
+ sourcemaps . add ( file , function ( err , data ) {
205
132
expect ( / s o u r c e M a p p i n g U R L / . test ( data . contents . toString ( ) ) ) . toNotExist ( ) ;
206
133
done ( err ) ;
207
134
} ) ;
@@ -210,7 +137,7 @@ describe('add', function() {
210
137
it ( 'should load external source map if no source mapping comment' , function ( done ) {
211
138
var file = makeFile ( ) ;
212
139
file . path = file . path . replace ( 'helloworld.js' , 'helloworld2.js' ) ;
213
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
140
+ sourcemaps . add ( file , function ( err , data ) {
214
141
expect ( data . sourceMap ) . toExist ( ) ;
215
142
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
216
143
expect ( data . sourceMap . sources ) . toEqual ( [ 'helloworld2.js' ] ) ;
@@ -223,7 +150,7 @@ describe('add', function() {
223
150
it ( 'should load external source map and add sourceContent if missing' , function ( done ) {
224
151
var file = makeFile ( ) ;
225
152
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld3.js.map' ) ;
226
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
153
+ sourcemaps . add ( file , function ( err , data ) {
227
154
expect ( data . sourceMap ) . toExist ( ) ;
228
155
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
229
156
expect ( data . sourceMap . sources ) . toEqual ( [ 'helloworld.js' , 'test1.js' ] ) ;
@@ -236,7 +163,7 @@ describe('add', function() {
236
163
it ( 'should not throw when source file for sourceContent not found' , function ( done ) {
237
164
var file = makeFile ( ) ;
238
165
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld4.js.map' ) ;
239
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
166
+ sourcemaps . add ( file , function ( err , data ) {
240
167
expect ( data . sourceMap ) . toExist ( ) ;
241
168
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
242
169
expect ( data . sourceMap . sources ) . toEqual ( [ 'helloworld.js' , 'missingfile' ] ) ;
@@ -259,7 +186,7 @@ describe('add', function() {
259
186
it ( 'should use sourceRoot when resolving path to sources' , function ( done ) {
260
187
var file = makeFile ( ) ;
261
188
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld5.js.map' ) ;
262
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
189
+ sourcemaps . add ( file , function ( err , data ) {
263
190
expect ( data . sourceMap ) . toExist ( [ ] ) ;
264
191
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
265
192
expect ( data . sourceMap . sources ) . toEqual ( [ '../helloworld.js' , '../test1.js' ] ) ;
@@ -273,7 +200,7 @@ describe('add', function() {
273
200
it ( 'should not load source conent if the path is a url' , function ( done ) {
274
201
var file = makeFile ( ) ;
275
202
file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld6.js.map' ) ;
276
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
203
+ sourcemaps . add ( file , function ( err , data ) {
277
204
expect ( data . sourceMap ) . toExist ( ) ;
278
205
expect ( String ( data . sourceMap . version ) ) . toBe ( '3' ) ;
279
206
expect ( data . sourceMap . sources ) . toEqual ( [ 'helloworld.js' , 'http://example2.com/test1.js' ] ) ;
@@ -283,17 +210,6 @@ describe('add', function() {
283
210
} ) ;
284
211
} ) ;
285
212
286
- it . skip ( 'should output an error message if debug option is set and sourceContent is missing' , function ( done ) {
287
- var file = makeFile ( ) ;
288
- file . contents = new Buffer ( sourceContent + '\n//# sourceMappingURL=helloworld4.js.map' ) ;
289
- var hConsole = '' ; // Removed
290
- sourcemaps . add ( file , { loadMaps : true , debug : true } , function ( err ) {
291
- expect ( hConsole . history . log [ 0 ] ) . toEqual ( 'vinyl-sourcemap-add: No source content for "missingfile". Loading from file.' ) ;
292
- expect ( hConsole . history . warn [ 0 ] . indexOf ( 'vinyl-sourcemap-add: source file not found: ' ) === 0 ) . toExist ( ) ;
293
- done ( err ) ;
294
- } ) ;
295
- } ) ;
296
-
297
213
it ( 'should pass through whe file already has a source map' , function ( done ) {
298
214
var sourceMap = {
299
215
version : 3 ,
@@ -305,7 +221,7 @@ describe('add', function() {
305
221
306
222
var file = makeFile ( ) ;
307
223
file . sourceMap = sourceMap ;
308
- sourcemaps . add ( file , { loadMaps : true } , function ( err , data ) {
224
+ sourcemaps . add ( file , function ( err , data ) {
309
225
expect ( data ) . toExist ( ) ;
310
226
expect ( data instanceof File ) . toExist ( ) ;
311
227
expect ( data . sourceMap ) . toBe ( sourceMap ) ;
0 commit comments