@@ -256,6 +256,29 @@ describe('rollup-plugin-babel', function() {
256
256
} ) ;
257
257
} ) ;
258
258
259
+ it ( 'throws when trying to add babel helper unavailable in used @babel/core version' , ( ) => {
260
+ return bundle ( 'samples/basic/main.js' , {
261
+ plugins : [
262
+ function ( ) {
263
+ return {
264
+ visitor : {
265
+ Program ( path , state ) {
266
+ state . file . addHelper ( '__nonexistentHelper' ) ;
267
+ } ,
268
+ } ,
269
+ } ;
270
+ } ,
271
+ ] ,
272
+ } ) . then (
273
+ ( ) => {
274
+ assert . ok ( false ) ;
275
+ } ,
276
+ err => {
277
+ assert . equal ( err . message , 'Unknown helper __nonexistentHelper' ) ;
278
+ } ,
279
+ ) ;
280
+ } ) ;
281
+
259
282
it ( 'supports customizing the loader' , ( ) => {
260
283
const customBabelPlugin = babelPlugin . custom ( ( ) => {
261
284
return {
@@ -275,10 +298,7 @@ describe('rollup-plugin-babel', function() {
275
298
} ;
276
299
} ) ;
277
300
return rollup
278
- . rollup ( {
279
- input : 'samples/basic/main.js' ,
280
- plugins : [ customBabelPlugin ( ) ] ,
281
- } )
301
+ . rollup ( { input : 'samples/basic/main.js' , plugins : [ customBabelPlugin ( ) ] } )
282
302
. then ( bundle => {
283
303
return bundle . generate ( { format : 'cjs' } ) ;
284
304
} )
@@ -310,10 +330,7 @@ describe('rollup-plugin-babel', function() {
310
330
} ;
311
331
} ) ;
312
332
return rollup
313
- . rollup ( {
314
- input : 'samples/basic/main.js' ,
315
- plugins : [ customBabelPlugin ( ) ] ,
316
- } )
333
+ . rollup ( { input : 'samples/basic/main.js' , plugins : [ customBabelPlugin ( ) ] } )
317
334
. then ( bundle => {
318
335
return bundle . generate ( { format : 'cjs' } ) ;
319
336
} )
0 commit comments