Skip to content

Commit 6533163

Browse files
committed
fix test
1 parent 28ffa02 commit 6533163

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test/integration/script-loader/test/index.test.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,25 @@ const runTests = (isDev) => {
151151
expect(script.attr('data-nscript')).toBeDefined()
152152

153153
// Script is inserted before NextScripts
154+
let scriptCount
154155
if (process.env.TURBOPACK) {
155156
// Turbopack generates different script names
156-
expect(
157-
$(
157+
if (isDev) {
158+
scriptCount = $(
158159
`#${id} ~ script[src^="/_next/static/chunks/%5Broot-of-the-server%5D__"]`
159160
).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+
}
161167
} 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
165171
}
172+
expect(scriptCount).toBeGreaterThan(0)
166173
}
167174

168175
test('scriptBeforePageRenderOld')

0 commit comments

Comments
 (0)