@@ -480,6 +480,8 @@ export default testSuite(({ describe }, node: NodeApis) => {
480
480
nodeOptions : [ ] ,
481
481
} ) ;
482
482
expect ( stdout ) . toBe ( 'file.ts\nfoo.ts\njson.json\npromises\nbar.ts\npkg.js\nnode:process' ) ;
483
+ } , {
484
+ retry : 3 ,
483
485
} ) ;
484
486
485
487
test ( 'namespace & onImport' , async ( ) => {
@@ -508,6 +510,8 @@ export default testSuite(({ describe }, node: NodeApis) => {
508
510
nodeOptions : [ ] ,
509
511
} ) ;
510
512
expect ( stdout ) . toBe ( 'file.ts\nfoo.ts\njson.json\nbar.ts\npkg.js' ) ;
513
+ } , {
514
+ retry : 3 ,
511
515
} ) ;
512
516
513
517
describe ( 'tsconfig' , ( { test } ) => {
@@ -702,6 +706,12 @@ export default testSuite(({ describe }, node: NodeApis) => {
702
706
const { message: message2 } = await tsImport('./file.ts?with-query', __filename);
703
707
console.log(message2);
704
708
709
+ const cts = await tsImport('./cjs/exports-yes.cts', __filename).then(({ cjsReexport, esmSyntax }) => \`\${cjsReexport} \${esmSyntax}\`, err => err.constructor.name);
710
+ console.log(cts);
711
+
712
+ const cjs = await tsImport('./cjs/reexport.cjs', __filename).then(({ cjsReexport, esmSyntax }) => \`\${cjsReexport} \${esmSyntax}\`, err => err.constructor.name);
713
+ console.log(cjs);
714
+
705
715
// Global not polluted
706
716
await import('./file.ts?nocache').catch((error) => {
707
717
console.log('Fails as expected 2');
@@ -715,7 +725,25 @@ export default testSuite(({ describe }, node: NodeApis) => {
715
725
nodePath : node . path ,
716
726
nodeOptions : [ ] ,
717
727
} ) ;
718
- expect ( stdout ) . toMatch ( / F a i l s a s e x p e c t e d 1 \n f o o b a r j s o n f i l e \. t s \? t s x - n a m e s p a c e = \d + \n f o o b a r j s o n f i l e \. t s \? w i t h - q u e r y = & t s x - n a m e s p a c e = \d + \n F a i l s a s e x p e c t e d 2 / ) ;
728
+ if ( node . supports . cjsInterop ) {
729
+ expect ( stdout ) . toMatch ( new RegExp (
730
+ `${ String . raw `Fails as expected 1\n`
731
+ + String . raw `foo bar json file\.ts\?tsx-namespace=\d+\n`
732
+ + String . raw `foo bar json file\.ts\?with-query=&tsx-namespace=\d+\n`
733
+ + String . raw `cjsReexport esm syntax\n`
734
+ + String . raw `cjsReexport esm syntax\n`
735
+ } Fails as expected 2`,
736
+ ) ) ;
737
+ } else {
738
+ expect ( stdout ) . toMatch ( new RegExp (
739
+ `${ String . raw `Fails as expected 1\n`
740
+ + String . raw `foo bar json file\.ts\?tsx-namespace=\d+\n`
741
+ + String . raw `foo bar json file\.ts\?with-query=&tsx-namespace=\d+\n`
742
+ + String . raw `SyntaxError\n`
743
+ + String . raw `Error\n`
744
+ } Fails as expected 2`,
745
+ ) ) ;
746
+ }
719
747
} ) ;
720
748
721
749
test ( 'mts from commonjs' , async ( ) => {
0 commit comments