Skip to content

Commit 3d00753

Browse files
ci: apply automated fixes
1 parent 027676c commit 3d00753

4 files changed

Lines changed: 140 additions & 94 deletions

File tree

‎e2e/react-start/basic/src/routes/inline-scripts.tsx‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ export const Route = createFileRoute({
22
head: () => ({
33
scripts: [
44
{
5-
children: 'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");'
5+
children:
6+
'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");',
67
},
78
{
8-
children: 'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");',
9-
type: 'text/javascript'
10-
}
9+
children:
10+
'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");',
11+
type: 'text/javascript',
12+
},
1113
],
1214
}),
1315
component: InlineScriptsComponent,
@@ -18,8 +20,9 @@ function InlineScriptsComponent() {
1820
<div className="p-2">
1921
<h3 data-testid="inline-scripts-test-heading">Inline Scripts Test</h3>
2022
<p>
21-
This route tests inline script duplication prevention. Two inline scripts should be loaded.
23+
This route tests inline script duplication prevention. Two inline
24+
scripts should be loaded.
2225
</p>
2326
</div>
2427
)
25-
}
28+
}

‎e2e/react-start/basic/tests/script-duplication.spec.ts‎

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,147 +4,167 @@ test.describe('Script Duplication Prevention', () => {
44
test('should not create duplicate scripts on SSR route', async ({ page }) => {
55
// Navigate directly to scripts route (SSR scenario)
66
await page.goto('/scripts')
7-
7+
88
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
9-
9+
1010
// Count script tags with src="script.js"
1111
const scriptCount = await page.evaluate(() => {
1212
return document.querySelectorAll('script[src="script.js"]').length
1313
})
14-
14+
1515
// Should have exactly one script tag
1616
expect(scriptCount).toBe(1)
17-
17+
1818
// Verify the script executed correctly
1919
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
2020
})
2121

22-
test('should not create duplicate scripts during client-side navigation', async ({ page }) => {
22+
test('should not create duplicate scripts during client-side navigation', async ({
23+
page,
24+
}) => {
2325
// Start from home page
2426
await page.goto('/')
25-
27+
2628
// Navigate to scripts route (client-side navigation)
2729
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
2830
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
29-
31+
3032
// Count script tags after first navigation
3133
const firstNavCount = await page.evaluate(() => {
3234
return document.querySelectorAll('script[src="script.js"]').length
3335
})
3436
expect(firstNavCount).toBe(1)
35-
37+
3638
// Navigate away from scripts route
3739
await page.getByRole('link', { name: 'Home' }).click()
3840
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
39-
41+
4042
// Navigate back to scripts route
4143
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
4244
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
43-
45+
4446
// Count script tags after second navigation - should still be 1
4547
const secondNavCount = await page.evaluate(() => {
4648
return document.querySelectorAll('script[src="script.js"]').length
4749
})
4850
expect(secondNavCount).toBe(1)
49-
51+
5052
// Verify the script is still working
5153
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
5254
})
5355

54-
test('should not create duplicate scripts with multiple navigation cycles', async ({ page }) => {
56+
test('should not create duplicate scripts with multiple navigation cycles', async ({
57+
page,
58+
}) => {
5559
// Start from home page
5660
await page.goto('/')
57-
61+
5862
// Navigate to scripts route multiple times
5963
for (let i = 0; i < 3; i++) {
6064
// Go to scripts
6165
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
6266
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
63-
67+
6468
// Go back to home
6569
await page.getByRole('link', { name: 'Home' }).click()
6670
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
6771
}
68-
72+
6973
// Final navigation to scripts
7074
await page.getByRole('link', { name: 'Scripts', exact: true }).click()
7175
await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()
72-
76+
7377
// Count script tags - should still be exactly 1
7478
const finalCount = await page.evaluate(() => {
7579
return document.querySelectorAll('script[src="script.js"]').length
7680
})
7781
expect(finalCount).toBe(1)
78-
82+
7983
// Verify the script is still working
8084
expect(await page.evaluate('window.SCRIPT_1')).toBe(true)
8185
})
8286

8387
test('should not create duplicate inline scripts', async ({ page }) => {
8488
// Navigate directly to inline scripts route (SSR scenario)
8589
await page.goto('/inline-scripts')
86-
87-
await expect(page.getByTestId('inline-scripts-test-heading')).toBeInViewport()
88-
90+
91+
await expect(
92+
page.getByTestId('inline-scripts-test-heading'),
93+
).toBeInViewport()
94+
8995
// Count specific inline scripts
9096
const script1Count = await page.evaluate(() => {
9197
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
92-
return scripts.filter(script =>
93-
script.textContent && script.textContent.includes('window.INLINE_SCRIPT_1 = true')
98+
return scripts.filter(
99+
(script) =>
100+
script.textContent &&
101+
script.textContent.includes('window.INLINE_SCRIPT_1 = true'),
94102
).length
95103
})
96-
104+
97105
const script2Count = await page.evaluate(() => {
98106
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
99-
return scripts.filter(script =>
100-
script.textContent && script.textContent.includes('window.INLINE_SCRIPT_2 = "test"')
107+
return scripts.filter(
108+
(script) =>
109+
script.textContent &&
110+
script.textContent.includes('window.INLINE_SCRIPT_2 = "test"'),
101111
).length
102112
})
103-
113+
104114
// Should have exactly one of each inline script
105115
expect(script1Count).toBe(1)
106116
expect(script2Count).toBe(1)
107-
117+
108118
// Verify the scripts executed correctly
109119
expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)
110120
expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')
111121
})
112122

113-
test('should not create duplicate inline scripts during client-side navigation', async ({ page }) => {
123+
test('should not create duplicate inline scripts during client-side navigation', async ({
124+
page,
125+
}) => {
114126
// Start from home page
115127
await page.goto('/')
116-
128+
117129
// Navigate to inline scripts route (client-side navigation)
118130
await page.getByRole('link', { name: 'Inline Scripts' }).click()
119-
await expect(page.getByTestId('inline-scripts-test-heading')).toBeInViewport()
120-
131+
await expect(
132+
page.getByTestId('inline-scripts-test-heading'),
133+
).toBeInViewport()
134+
121135
// Count inline scripts after first navigation
122136
const firstNavScript1Count = await page.evaluate(() => {
123137
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
124-
return scripts.filter(script =>
125-
script.textContent && script.textContent.includes('window.INLINE_SCRIPT_1 = true')
138+
return scripts.filter(
139+
(script) =>
140+
script.textContent &&
141+
script.textContent.includes('window.INLINE_SCRIPT_1 = true'),
126142
).length
127143
})
128144
expect(firstNavScript1Count).toBe(1)
129-
145+
130146
// Navigate away and back
131147
await page.getByRole('link', { name: 'Home' }).click()
132148
await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()
133-
149+
134150
await page.getByRole('link', { name: 'Inline Scripts' }).click()
135-
await expect(page.getByTestId('inline-scripts-test-heading')).toBeInViewport()
136-
151+
await expect(
152+
page.getByTestId('inline-scripts-test-heading'),
153+
).toBeInViewport()
154+
137155
// Count inline scripts after second navigation - should still be 1
138156
const secondNavScript1Count = await page.evaluate(() => {
139157
const scripts = Array.from(document.querySelectorAll('script:not([src])'))
140-
return scripts.filter(script =>
141-
script.textContent && script.textContent.includes('window.INLINE_SCRIPT_1 = true')
158+
return scripts.filter(
159+
(script) =>
160+
script.textContent &&
161+
script.textContent.includes('window.INLINE_SCRIPT_1 = true'),
142162
).length
143163
})
144164
expect(secondNavScript1Count).toBe(1)
145-
165+
146166
// Verify the scripts are still working
147167
expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)
148168
expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')
149169
})
150-
})
170+
})

‎e2e/solid-start/basic/src/routes/inline-scripts.tsx‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ export const Route = createFileRoute('/inline-scripts')({
44
head: () => ({
55
scripts: [
66
{
7-
children: 'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");'
7+
children:
8+
'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");',
89
},
910
{
10-
children: 'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");',
11-
type: 'text/javascript'
12-
}
11+
children:
12+
'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");',
13+
type: 'text/javascript',
14+
},
1315
],
1416
}),
1517
component: InlineScriptsComponent,
@@ -20,8 +22,9 @@ function InlineScriptsComponent() {
2022
<div class="p-2">
2123
<h3 data-testid="inline-scripts-test-heading">Inline Scripts Test</h3>
2224
<p>
23-
This route tests inline script duplication prevention. Two inline scripts should be loaded.
25+
This route tests inline script duplication prevention. Two inline
26+
scripts should be loaded.
2427
</p>
2528
</div>
2629
)
27-
}
30+
}

0 commit comments

Comments
 (0)