File tree 1 file changed +13
-6
lines changed
test/integration/script-loader/test
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -151,18 +151,25 @@ const runTests = (isDev) => {
151
151
expect ( script . attr ( 'data-nscript' ) ) . toBeDefined ( )
152
152
153
153
// Script is inserted before NextScripts
154
+ let scriptCount
154
155
if ( process . env . TURBOPACK ) {
155
156
// Turbopack generates different script names
156
- expect (
157
- $ (
157
+ if ( isDev ) {
158
+ scriptCount = $ (
158
159
`#${ id } ~ script[src^="/_next/static/chunks/%5Broot-of-the-server%5D__"]`
159
160
) . length
160
- ) . toBeGreaterThan ( 0 )
161
+ } else {
162
+ // In production mode, content hashes are used
163
+ scriptCount = $ (
164
+ `#${ id } ~ script[src^="/_next/static/chunks/"]`
165
+ ) . length
166
+ }
161
167
} else {
162
- expect (
163
- $ ( `#${ id } ~ script[src^="/_next/static/chunks/main"]` ) . length
164
- ) . toBeGreaterThan ( 0 )
168
+ scriptCount = $ (
169
+ `#${ id } ~ script[src^="/_next/static/chunks/main"]`
170
+ ) . length
165
171
}
172
+ expect ( scriptCount ) . toBeGreaterThan ( 0 )
166
173
}
167
174
168
175
test ( 'scriptBeforePageRenderOld' )
You can’t perform that action at this time.
0 commit comments