Skip to content

Commit f84b6b4

Browse files
authored
test: fix Nuxt 4.5 and TikTok e2e failures (#838)
1 parent 343573d commit f84b6b4

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎test/e2e/tiktok-pixel.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ describe('tiktokPixel', async () => {
6060
.map(s => s.src)
6161
.find((s) => {
6262
try {
63-
return new URL(s).hostname === 'analytics.tiktok.com'
63+
const scriptUrl = new URL(s)
64+
return scriptUrl.hostname === 'analytics.tiktok.com'
65+
&& scriptUrl.pathname === '/i18n/pixel/events.js'
6466
}
6567
catch {
6668
return false

‎test/fixtures/basic/pages/bundle-use-script.vue‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts" setup>
2-
import { injectHead, ref, useScript } from '#imports'
2+
import { ref, useScript } from '#imports'
33
4-
const { onLoaded } = useScript<{ myScript: (arg: string) => void }>(
4+
const { id, onLoaded } = useScript<{ myScript: (arg: string) => void }>(
55
// need a real script to bundle
66
'https://code.jquery.com/jquery-3.6.0.min.js',
77
{
@@ -16,10 +16,8 @@ const { onLoaded } = useScript<{ myScript: (arg: string) => void }>(
1616
)
1717
1818
const scriptSrc = ref('https://code.jquery.com/jquery-3.6.0.min.js')
19-
onLoaded(async () => {
20-
const head = injectHead()
21-
const tags = await head.resolveTags()
22-
scriptSrc.value = tags.filter(s => s.tag === 'script')[0].props.src
19+
onLoaded(() => {
20+
scriptSrc.value = id
2321
})
2422
</script>
2523

0 commit comments

Comments
 (0)