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 @@ -114,18 +114,25 @@ const runTests = (isDev) => {
114
114
expect ( script . attr ( 'data-nscript' ) ) . toBeDefined ( )
115
115
116
116
// Script is inserted before NextScripts
117
+ let scriptCount
117
118
if ( process . env . TURBOPACK ) {
118
119
// Turbopack generates different script names
119
- expect (
120
- $ (
120
+ if ( isDev ) {
121
+ scriptCount = $ (
121
122
`#${ id } ~ script[src^="/_next/static/chunks/%5Broot-of-the-server%5D__"]`
122
123
) . length
123
- ) . toBeGreaterThan ( 0 )
124
+ } else {
125
+ // In production mode, content hashes are used
126
+ scriptCount = $ (
127
+ `#${ id } ~ script[src^="/_next/static/chunks/"]`
128
+ ) . length
129
+ }
124
130
} else {
125
- expect (
126
- $ ( `#${ id } ~ script[src^="/_next/static/chunks/main"]` ) . length
127
- ) . toBeGreaterThan ( 0 )
131
+ scriptCount = $ (
132
+ `#${ id } ~ script[src^="/_next/static/chunks/main"]`
133
+ ) . length
128
134
}
135
+ expect ( scriptCount ) . toBeGreaterThan ( 0 )
129
136
}
130
137
131
138
test ( 'scriptBeforeInteractive' )
You can’t perform that action at this time.
0 commit comments