@@ -18,8 +18,6 @@ test('require a .ts file with explicit extension succeeds', async () => {
1818 strictEqual ( result . code , 0 ) ;
1919} ) ;
2020
21- // TODO(marco-ippolito) This test should fail because extensionless require
22- // but it's behaving like a .js file
2321test ( 'eval require a .ts file with implicit extension fails' , async ( ) => {
2422 const result = await spawnPromisified ( process . execPath , [
2523 '--experimental-strip-types' ,
@@ -30,23 +28,36 @@ test('eval require a .ts file with implicit extension fails', async () => {
3028 cwd : fixtures . path ( 'typescript/ts' ) ,
3129 } ) ;
3230
33- strictEqual ( result . stderr , '' ) ;
34- match ( result . stdout , / H e l l o , T y p e S c r i p t ! / ) ;
35- strictEqual ( result . code , 0 ) ;
31+ strictEqual ( result . stdout , '' ) ;
32+ match ( result . stderr , / E r r o r : C a n n o t f i n d m o d u l e / ) ;
33+ strictEqual ( result . code , 1 ) ;
34+ } ) ;
35+
36+ test ( 'eval require a .cts file with implicit extension fails' , async ( ) => {
37+ const result = await spawnPromisified ( process . execPath , [
38+ '--experimental-strip-types' ,
39+ '--eval' ,
40+ 'require("./test-cts-typescript")' ,
41+ '--no-warnings' ,
42+ ] , {
43+ cwd : fixtures . path ( 'typescript/ts' ) ,
44+ } ) ;
45+
46+ strictEqual ( result . stdout , '' ) ;
47+ match ( result . stderr , / E r r o r : C a n n o t f i n d m o d u l e / ) ;
48+ strictEqual ( result . code , 1 ) ;
3649} ) ;
3750
38- // TODO(marco-ippolito) This test should fail because extensionless require
39- // but it's behaving like a .js file
4051test ( 'require a .ts file with implicit extension fails' , async ( ) => {
4152 const result = await spawnPromisified ( process . execPath , [
4253 '--experimental-strip-types' ,
4354 '--no-warnings' ,
4455 fixtures . path ( 'typescript/cts/test-extensionless-require.ts' ) ,
4556 ] ) ;
4657
47- strictEqual ( result . stderr , '' ) ;
48- match ( result . stdout , / H e l l o , T y p e S c r i p t ! / ) ;
49- strictEqual ( result . code , 0 ) ;
58+ strictEqual ( result . stdout , '' ) ;
59+ match ( result . stderr , / E r r o r : C a n n o t f i n d m o d u l e / ) ;
60+ strictEqual ( result . code , 1 ) ;
5061} ) ;
5162
5263test ( 'expect failure of an .mts file with CommonJS syntax' , async ( ) => {
0 commit comments