@@ -110,36 +110,36 @@ test('expect fail eval TypeScript ESM syntax with input-type commonjs-typescript
110110 strictEqual ( result . code , 1 ) ;
111111} ) ;
112112
113- test ( 'check syntax error is thrown when passing invalid syntax' , async ( ) => {
113+ test ( 'check syntax error is thrown when passing unsupported syntax' , async ( ) => {
114114 const result = await spawnPromisified ( process . execPath , [
115115 '--experimental-strip-types' ,
116116 '--eval' ,
117117 'enum Foo { A, B, C }' ] ) ;
118118 strictEqual ( result . stdout , '' ) ;
119119 match ( result . stderr , / S y n t a x E r r o r / ) ;
120- doesNotMatch ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
120+ doesNotMatch ( result . stderr , / E R R _ U N S U P P O R T E D _ T Y P E S C R I P T _ S Y N T A X / ) ;
121121 strictEqual ( result . code , 1 ) ;
122122} ) ;
123123
124- test ( 'check syntax error is thrown when passing invalid syntax with --input-type=module-typescript' , async ( ) => {
124+ test ( 'check syntax error is thrown when passing unsupported syntax with --input-type=module-typescript' , async ( ) => {
125125 const result = await spawnPromisified ( process . execPath , [
126126 '--experimental-strip-types' ,
127127 '--input-type=module-typescript' ,
128128 '--eval' ,
129129 'enum Foo { A, B, C }' ] ) ;
130130 strictEqual ( result . stdout , '' ) ;
131- match ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
131+ match ( result . stderr , / E R R _ U N S U P P O R T E D _ T Y P E S C R I P T _ S Y N T A X / ) ;
132132 strictEqual ( result . code , 1 ) ;
133133} ) ;
134134
135- test ( 'check syntax error is thrown when passing invalid syntax with --input-type=commonjs-typescript' , async ( ) => {
135+ test ( 'check syntax error is thrown when passing unsupported syntax with --input-type=commonjs-typescript' , async ( ) => {
136136 const result = await spawnPromisified ( process . execPath , [
137137 '--experimental-strip-types' ,
138138 '--input-type=commonjs-typescript' ,
139139 '--eval' ,
140140 'enum Foo { A, B, C }' ] ) ;
141141 strictEqual ( result . stdout , '' ) ;
142- match ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
142+ match ( result . stderr , / E R R _ U N S U P P O R T E D _ T Y P E S C R I P T _ S Y N T A X / ) ;
143143 strictEqual ( result . code , 1 ) ;
144144} ) ;
145145
@@ -152,7 +152,7 @@ test('should not parse TypeScript with --type-module=commonjs', async () => {
152152
153153 strictEqual ( result . stdout , '' ) ;
154154 match ( result . stderr , / S y n t a x E r r o r / ) ;
155- doesNotMatch ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
155+ doesNotMatch ( result . stderr , / E R R _ U N S U P P O R T E D _ T Y P E S C R I P T _ S Y N T A X / ) ;
156156 strictEqual ( result . code , 1 ) ;
157157} ) ;
158158
@@ -165,7 +165,7 @@ test('should not parse TypeScript with --type-module=module', async () => {
165165
166166 strictEqual ( result . stdout , '' ) ;
167167 match ( result . stderr , / S y n t a x E r r o r / ) ;
168- doesNotMatch ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
168+ doesNotMatch ( result . stderr , / E R R _ U N S U P P O R T E D _ T Y P E S C R I P T _ S Y N T A X / ) ;
169169 strictEqual ( result . code , 1 ) ;
170170} ) ;
171171
@@ -241,3 +241,25 @@ test('typescript CJS code is throwing a syntax error at runtime', async () => {
241241 strictEqual ( result . stdout , '' ) ;
242242 strictEqual ( result . code , 1 ) ;
243243} ) ;
244+
245+ test ( 'check syntax error is thrown when passing invalid syntax with --input-type=commonjs-typescript' , async ( ) => {
246+ const result = await spawnPromisified ( process . execPath , [
247+ '--experimental-strip-types' ,
248+ '--input-type=commonjs-typescript' ,
249+ '--eval' ,
250+ 'function foo(){ await Promise.resolve(1); }' ] ) ;
251+ strictEqual ( result . stdout , '' ) ;
252+ match ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
253+ strictEqual ( result . code , 1 ) ;
254+ } ) ;
255+
256+ test ( 'check syntax error is thrown when passing invalid syntax with --input-type=module-typescript' , async ( ) => {
257+ const result = await spawnPromisified ( process . execPath , [
258+ '--experimental-strip-types' ,
259+ '--input-type=module-typescript' ,
260+ '--eval' ,
261+ 'function foo(){ await Promise.resolve(1); }' ] ) ;
262+ strictEqual ( result . stdout , '' ) ;
263+ match ( result . stderr , / E R R _ I N V A L I D _ T Y P E S C R I P T _ S Y N T A X / ) ;
264+ strictEqual ( result . code , 1 ) ;
265+ } ) ;
0 commit comments