@@ -80,12 +80,24 @@ describe('file url', () => {
80
80
export default dep;
81
81
`
82
82
}
83
+ if ( id === '\0virtual:test-dep/static-postfix' ) {
84
+ return `
85
+ import * as dep from ${ JSON . stringify ( fileUrl . href + '?query=test' ) } ;
86
+ export default dep;
87
+ `
88
+ }
83
89
if ( id === '\0virtual:test-dep/non-static' ) {
84
90
return `
85
91
const dep = await import(/* @vite-ignore */ String(${ JSON . stringify ( fileUrl . href ) } ));
86
92
export default dep;
87
93
`
88
94
}
95
+ if ( id === '\0virtual:test-dep/non-static-postfix' ) {
96
+ return `
97
+ const dep = await import(/* @vite-ignore */ String(${ JSON . stringify ( fileUrl . href + '?query=test' ) } ));
98
+ export default dep;
99
+ `
100
+ }
89
101
} ,
90
102
} ,
91
103
] ,
@@ -114,6 +126,20 @@ describe('file url', () => {
114
126
115
127
const mod4 = await runner . import ( 'virtual:test-dep/non-static' )
116
128
expect ( mod4 . default ) . toBe ( mod )
129
+
130
+ const mod5 = await runner . import ( fileUrl . href + '?query=test' )
131
+ expect ( mod5 ) . toEqual ( mod )
132
+ expect ( mod5 ) . not . toBe ( mod )
133
+
134
+ const mod6 = await runner . import ( 'virtual:test-dep/static-postfix' )
135
+ expect ( mod6 . default ) . toEqual ( mod )
136
+ expect ( mod6 . default ) . not . toBe ( mod )
137
+ expect ( mod6 . default ) . toBe ( mod5 )
138
+
139
+ const mod7 = await runner . import ( 'virtual:test-dep/non-static-postfix' )
140
+ expect ( mod7 . default ) . toEqual ( mod )
141
+ expect ( mod7 . default ) . not . toBe ( mod )
142
+ expect ( mod7 . default ) . toBe ( mod5 )
117
143
} )
118
144
119
145
describe ( 'environment builtins' , ( ) => {
0 commit comments