@@ -102,33 +102,33 @@ test('expect fail eval TypeScript ESM syntax with input-type commonjs-typescript
102
102
strictEqual ( result . code , 1 ) ;
103
103
} ) ;
104
104
105
- test ( 'check syntax error is thrown when passing invalid syntax' , async ( ) => {
105
+ test ( 'check syntax error is thrown when passing unsupported syntax' , async ( ) => {
106
106
const result = await spawnPromisified ( process . execPath , [
107
107
'--eval' ,
108
108
'enum Foo { A, B, C }' ] ) ;
109
109
strictEqual ( result . stdout , '' ) ;
110
110
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 / ) ;
112
112
strictEqual ( result . code , 1 ) ;
113
113
} ) ;
114
114
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 ( ) => {
116
116
const result = await spawnPromisified ( process . execPath , [
117
117
'--input-type=module-typescript' ,
118
118
'--eval' ,
119
119
'enum Foo { A, B, C }' ] ) ;
120
120
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 / ) ;
122
122
strictEqual ( result . code , 1 ) ;
123
123
} ) ;
124
124
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 ( ) => {
126
126
const result = await spawnPromisified ( process . execPath , [
127
127
'--input-type=commonjs-typescript' ,
128
128
'--eval' ,
129
129
'enum Foo { A, B, C }' ] ) ;
130
130
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 / ) ;
132
132
strictEqual ( result . code , 1 ) ;
133
133
} ) ;
134
134
@@ -140,7 +140,7 @@ test('should not parse TypeScript with --type-module=commonjs', async () => {
140
140
141
141
strictEqual ( result . stdout , '' ) ;
142
142
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 / ) ;
144
144
strictEqual ( result . code , 1 ) ;
145
145
} ) ;
146
146
@@ -152,7 +152,7 @@ test('should not parse TypeScript with --type-module=module', async () => {
152
152
153
153
strictEqual ( result . stdout , '' ) ;
154
154
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 / ) ;
156
156
strictEqual ( result . code , 1 ) ;
157
157
} ) ;
158
158
@@ -222,3 +222,23 @@ test('typescript CJS code is throwing a syntax error at runtime', async () => {
222
222
strictEqual ( result . stdout , '' ) ;
223
223
strictEqual ( result . code , 1 ) ;
224
224
} ) ;
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