@@ -80,6 +80,7 @@ test('should override env-file', async () => {
80
80
test ( 'should not override NODE_OPTIONS' , async ( ) => {
81
81
const result = await spawnPromisified ( process . execPath , [
82
82
'--no-warnings' ,
83
+ '--experimental-strip-types' ,
83
84
'--experimental-config-file' ,
84
85
fixtures . path ( 'rc/transform-types.json' ) ,
85
86
fixtures . path ( 'typescript/ts/transformation/test-enum.ts' ) ,
@@ -254,3 +255,53 @@ test('should not allow users to sneak in a flag', async () => {
254
255
strictEqual ( result . stdout , '' ) ;
255
256
strictEqual ( result . code , 9 ) ;
256
257
} ) ;
258
+
259
+ test ( 'non object root' , async ( ) => {
260
+ const result = await spawnPromisified ( process . execPath , [
261
+ '--no-warnings' ,
262
+ '--experimental-config-file' ,
263
+ fixtures . path ( 'rc/non-object-root.json' ) ,
264
+ '-p' , '"Hello, World!"' ,
265
+ ] ) ;
266
+ match ( result . stderr , / R o o t v a l u e u n e x p e c t e d n o t a n o b j e c t f o r / ) ;
267
+ strictEqual ( result . stdout , '' ) ;
268
+ strictEqual ( result . code , 9 ) ;
269
+ } ) ;
270
+
271
+ test ( 'non object node options' , async ( ) => {
272
+ const result = await spawnPromisified ( process . execPath , [
273
+ '--no-warnings' ,
274
+ '--experimental-config-file' ,
275
+ fixtures . path ( 'rc/non-object-node-options.json' ) ,
276
+ '-p' , '"Hello, World!"' ,
277
+ ] ) ;
278
+ match ( result . stderr , / " n o d e O p t i o n s " v a l u e u n e x p e c t e d f o r / ) ;
279
+ strictEqual ( result . stdout , '' ) ;
280
+ strictEqual ( result . code , 9 ) ;
281
+ } ) ;
282
+
283
+ test ( 'should throw correct error when a json is broken' , async ( ) => {
284
+ const result = await spawnPromisified ( process . execPath , [
285
+ '--no-warnings' ,
286
+ '--experimental-config-file' ,
287
+ fixtures . path ( 'rc/broken.json' ) ,
288
+ '-p' , '"Hello, World!"' ,
289
+ ] ) ;
290
+ match ( result . stderr , / C a n ' t p a r s e / ) ;
291
+ match ( result . stderr , / b r o k e n \. j s o n : i n v a l i d c o n t e n t / ) ;
292
+ strictEqual ( result . stdout , '' ) ;
293
+ strictEqual ( result . code , 9 ) ;
294
+ } ) ;
295
+
296
+ test ( 'broken value in node_options' , async ( ) => {
297
+ const result = await spawnPromisified ( process . execPath , [
298
+ '--no-warnings' ,
299
+ '--experimental-config-file' ,
300
+ fixtures . path ( 'rc/broken-node-options.json' ) ,
301
+ '-p' , '"Hello, World!"' ,
302
+ ] ) ;
303
+ match ( result . stderr , / C a n ' t p a r s e / ) ;
304
+ match ( result . stderr , / b r o k e n - n o d e - o p t i o n s \. j s o n : i n v a l i d c o n t e n t / ) ;
305
+ strictEqual ( result . stdout , '' ) ;
306
+ strictEqual ( result . code , 9 ) ;
307
+ } ) ;
0 commit comments