Skip to content

Commit 46a71ef

Browse files
committed
update snapshots for content hashes
1 parent e9aefd2 commit 46a71ef

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
@@ -114,18 +114,25 @@ const runTests = (isDev) => {
114114
expect(script.attr('data-nscript')).toBeDefined()
115115

116116
// Script is inserted before NextScripts
117+
let scriptCount
117118
if (process.env.TURBOPACK) {
118119
// Turbopack generates different script names
119-
expect(
120-
$(
120+
if (isDev) {
121+
scriptCount = $(
121122
`#${id} ~ script[src^="/_next/static/chunks/%5Broot-of-the-server%5D__"]`
122123
).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+
}
124130
} 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
128134
}
135+
expect(scriptCount).toBeGreaterThan(0)
129136
}
130137

131138
test('scriptBeforeInteractive')

0 commit comments

Comments
 (0)