@@ -352,3 +352,36 @@ test('execute a TypeScript test mocking module', { skip: isWindows && process.ar
352352 match ( result . stdout , / H e l l o , T y p e S c r i p t - C o m m o n J S ! / ) ;
353353 strictEqual ( result . code , 0 ) ;
354354} ) ;
355+
356+ test ( 'execute a TypeScript file with union types' , async ( ) => {
357+ const result = await spawnPromisified ( process . execPath , [
358+ '--experimental-strip-types' ,
359+ '--no-warnings' ,
360+ fixtures . path ( 'typescript/ts/test-union-types.ts' ) ,
361+ ] ) ;
362+
363+ strictEqual ( result . stderr , '' ) ;
364+ strictEqual ( result . stdout ,
365+ '{' +
366+ " name: 'Hello, TypeScript!' }\n" +
367+ '{ role: \'admin\', permission: \'all\' }\n' +
368+ '{\n foo: \'Testing Partial Type\',\n bar: 42,\n' +
369+ ' zoo: true,\n metadata: undefined\n' +
370+ '}\n' ) ;
371+ strictEqual ( result . code , 0 ) ;
372+ } ) ;
373+
374+ test ( 'expect error when executing a TypeScript file with generics' , async ( ) => {
375+ const result = await spawnPromisified ( process . execPath , [
376+ '--experimental-strip-types' ,
377+ fixtures . path ( 'typescript/ts/test-parameter-properties.ts' ) ,
378+ ] ) ;
379+
380+ // This error should be thrown during transformation
381+ match (
382+ result . stderr ,
383+ / T y p e S c r i p t p a r a m e t e r p r o p e r t y i s n o t s u p p o r t e d i n s t r i p - o n l y m o d e /
384+ ) ;
385+ strictEqual ( result . stdout , '' ) ;
386+ strictEqual ( result . code , 1 ) ;
387+ } ) ;
0 commit comments