@@ -102,33 +102,33 @@ test('expect fail eval TypeScript ESM syntax with input-type commonjs-typescript
102102 strictEqual ( result . code , 1 ) ;
103103} ) ;
104104
105- test ( 'check syntax error is thrown when passing invalid syntax' , async ( ) => {
105+ test ( 'check syntax error is thrown when passing unsupported syntax' , async ( ) => {
106106 const result = await spawnPromisified ( process . execPath , [
107107 '--eval' ,
108108 'enum Foo { A, B, C }' ] ) ;
109109 strictEqual ( result . stdout , '' ) ;
110110 match ( result . stderr , / S y n t a x E r r o r / ) ;
111- 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 / ) ;
111+ 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 / ) ;
112112 strictEqual ( result . code , 1 ) ;
113113} ) ;
114114
115- test ( 'check syntax error is thrown when passing invalid syntax with --input-type=module-typescript' , async ( ) => {
115+ test ( 'check syntax error is thrown when passing unsupported syntax with --input-type=module-typescript' , async ( ) => {
116116 const result = await spawnPromisified ( process . execPath , [
117117 '--input-type=module-typescript' ,
118118 '--eval' ,
119119 'enum Foo { A, B, C }' ] ) ;
120120 strictEqual ( result . stdout , '' ) ;
121- 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 / ) ;
121+ 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 / ) ;
122122 strictEqual ( result . code , 1 ) ;
123123} ) ;
124124
125- test ( 'check syntax error is thrown when passing invalid syntax with --input-type=commonjs-typescript' , async ( ) => {
125+ test ( 'check syntax error is thrown when passing unsupported syntax with --input-type=commonjs-typescript' , async ( ) => {
126126 const result = await spawnPromisified ( process . execPath , [
127127 '--input-type=commonjs-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
@@ -140,7 +140,7 @@ test('should not parse TypeScript with --type-module=commonjs', async () => {
140140
141141 strictEqual ( result . stdout , '' ) ;
142142 match ( result . stderr , / S y n t a x E r r o r / ) ;
143- 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 / ) ;
143+ 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 / ) ;
144144 strictEqual ( result . code , 1 ) ;
145145} ) ;
146146
@@ -152,7 +152,7 @@ test('should not parse TypeScript with --type-module=module', 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
@@ -222,3 +222,23 @@ test('typescript CJS code is throwing a syntax error at runtime', async () => {
222222 strictEqual ( result . stdout , '' ) ;
223223 strictEqual ( result . code , 1 ) ;
224224} ) ;
225+
226+ test ( 'check syntax error is thrown when passing invalid syntax with --input-type=commonjs-typescript' , async ( ) => {
227+ const result = await spawnPromisified ( process . execPath , [
228+ '--input-type=commonjs-typescript' ,
229+ '--eval' ,
230+ 'function foo(){ await Promise.resolve(1); }' ] ) ;
231+ strictEqual ( result . stdout , '' ) ;
232+ 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 / ) ;
233+ strictEqual ( result . code , 1 ) ;
234+ } ) ;
235+
236+ test ( 'check syntax error is thrown when passing invalid syntax with --input-type=module-typescript' , async ( ) => {
237+ const result = await spawnPromisified ( process . execPath , [
238+ '--input-type=module-typescript' ,
239+ '--eval' ,
240+ 'function foo(){ await Promise.resolve(1); }' ] ) ;
241+ strictEqual ( result . stdout , '' ) ;
242+ 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 / ) ;
243+ strictEqual ( result . code , 1 ) ;
244+ } ) ;
0 commit comments