@@ -3,6 +3,7 @@ import semver from 'semver';
33import type { NodeApis } from '../../utils/node-with-loader.js' ;
44import nodeSupports from '../../utils/node-supports.js' ;
55import { assertNotFound } from '../../utils/assertions.js' ;
6+ import { query } from '../../utils/query.js' ;
67
78export default testSuite ( async ( { describe } , node : NodeApis ) => {
89 describe ( '.ts extension' , ( { describe } ) => {
@@ -58,6 +59,12 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
5859 assertResults ( nodeProcess . stdout ) ;
5960 expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
6061 } ) ;
62+
63+ test ( 'Import with query' , async ( ) => {
64+ const nodeProcess = await node . import ( importPath + query , { typescript : true } ) ;
65+ assertResults ( nodeProcess . stdout ) ;
66+ expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
67+ } ) ;
6168 } ) ;
6269
6370 describe ( 'extensionless' , ( { test } ) => {
@@ -73,6 +80,12 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
7380 assertResults ( nodeProcess . stdout ) ;
7481 expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
7582 } ) ;
83+
84+ test ( 'Import with query' , async ( ) => {
85+ const nodeProcess = await node . import ( importPath + query , { typescript : true } ) ;
86+ assertResults ( nodeProcess . stdout ) ;
87+ expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
88+ } ) ;
7689 } ) ;
7790
7891 describe ( 'extensionless with subextension' , ( { test } ) => {
@@ -88,6 +101,12 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
88101 assertResults ( nodeProcess . stdout , 'ts-ext-ts/index.tsx.ts' ) ;
89102 expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
90103 } ) ;
104+
105+ test ( 'Import with query' , async ( ) => {
106+ const nodeProcess = await node . import ( importPath + query ) ;
107+ assertResults ( nodeProcess . stdout , 'ts-ext-ts/index.tsx.ts' ) ;
108+ expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
109+ } ) ;
91110 } ) ;
92111
93112 describe ( 'directory' , ( { test } ) => {
@@ -103,6 +122,12 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
103122 assertResults ( nodeProcess . stdout ) ;
104123 expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
105124 } ) ;
125+
126+ test ( 'Import with query' , async ( ) => {
127+ const nodeProcess = await node . import ( importPath + query ) ;
128+ assertResults ( nodeProcess . stdout ) ;
129+ expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
130+ } ) ;
106131 } ) ;
107132
108133 describe ( 'empty directory should fallback to file' , ( { test } ) => {
@@ -118,6 +143,12 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
118143 assertResults ( nodeProcess . stdout ) ;
119144 expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
120145 } ) ;
146+
147+ test ( 'Import with query' , async ( ) => {
148+ const nodeProcess = await node . import ( importPath + query ) ;
149+ assertResults ( nodeProcess . stdout ) ;
150+ expect ( nodeProcess . stdout ) . toMatch ( '{"default":1234}' ) ;
151+ } ) ;
121152 } ) ;
122153
123154 describe ( 'empty but explicit directory should not fallback to file' , ( { test } ) => {
@@ -127,6 +158,11 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
127158 const nodeProcess = await node . import ( importPath ) ;
128159 assertNotFound ( nodeProcess . stderr , importPath ) ;
129160 } ) ;
161+
162+ test ( 'Import with query' , async ( ) => {
163+ const nodeProcess = await node . import ( importPath + query ) ;
164+ assertNotFound ( nodeProcess . stderr , importPath ) ;
165+ } ) ;
130166 } ) ;
131167 } ) ;
132168} ) ;
0 commit comments