Skip to content

Commit 191583c

Browse files
[chore] upgrade to playwright 1.28.1 (sveltejs#7696)
* [chore] upgrade to Playwright 1.28.1 * wait for console event * better still * need to use a predicate since there are multiple console logs * stacktrace is unreliable * Revert "stacktrace is unreliable" This reverts commit 6c5e4d0. * solve stacktrace issue in another way * format * fix some turbo config Co-authored-by: Rich Harris <[email protected]>
1 parent 0984794 commit 191583c

File tree

8 files changed

+45
-28
lines changed

8 files changed

+45
-28
lines changed

.changeset/nine-rivers-argue.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-svelte': patch
3+
---
4+
5+
Upgrade to Playwright 1.28.1

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@rollup/plugin-json": "^5.0.1",
2828
"@rollup/plugin-node-resolve": "^15.0.1",
2929
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
30-
"playwright": "1.25.0",
30+
"playwright": "^1.28.1",
3131
"prettier": "^2.7.1",
3232
"rollup": "^2.79.1",
3333
"svelte": "^3.52.0",

packages/create-svelte/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"prompts": "^2.4.2"
1616
},
1717
"devDependencies": {
18-
"@playwright/test": "1.25.0",
18+
"@playwright/test": "^1.28.1",
1919
"@sveltejs/kit": "workspace:*",
2020
"@types/gitignore-parser": "^0.0.0",
2121
"@types/prettier": "^2.7.1",

packages/kit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"undici": "5.13.0"
2525
},
2626
"devDependencies": {
27-
"@playwright/test": "1.25.0",
27+
"@playwright/test": "^1.28.1",
2828
"@types/connect": "^3.4.35",
2929
"@types/marked": "^4.0.7",
3030
"@types/mime": "^3.0.1",

packages/kit/src/runtime/client/fetcher.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ if (import.meta.env.DEV) {
2626
const url = input instanceof Request ? input.url : input.toString();
2727
const stack = /** @type {string} */ (new Error().stack);
2828

29-
const heuristic = can_inspect_stack_trace ? stack.includes('load_node') : loading;
29+
// check if fetch was called via load_node. the lock method only checks if it was called at the
30+
// same time, but not necessarily if it was called from `load`
31+
// we use just the filename as the method name sometimes does not appear on the CI
32+
const heuristic = can_inspect_stack_trace
33+
? stack.includes('src/runtime/client/client.js')
34+
: loading;
3035
if (heuristic) {
3136
console.warn(
3237
`Loading ${url} using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/load#making-fetch-requests`

packages/kit/test/apps/basics/test/client.test.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -608,24 +608,28 @@ test.describe('Load', () => {
608608

609609
if (process.env.DEV) {
610610
test('using window.fetch causes a warning', async ({ page, baseURL }) => {
611+
await Promise.all([
612+
page.goto('/load/window-fetch/incorrect'),
613+
page.waitForEvent('console', {
614+
predicate: (message) => {
615+
return (
616+
message.text() ===
617+
`Loading ${baseURL}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/load#making-fetch-requests`
618+
);
619+
},
620+
timeout: 3_000
621+
})
622+
]);
623+
expect(await page.textContent('h1')).toBe('42');
624+
611625
/** @type {string[]} */
612626
const warnings = [];
613-
614627
page.on('console', (msg) => {
615628
if (msg.type() === 'warning') {
616629
warnings.push(msg.text());
617630
}
618631
});
619632

620-
await page.goto('/load/window-fetch/incorrect');
621-
expect(await page.textContent('h1')).toBe('42');
622-
623-
expect(warnings).toContain(
624-
`Loading ${baseURL}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/load#making-fetch-requests`
625-
);
626-
627-
warnings.length = 0;
628-
629633
await page.goto('/load/window-fetch/correct');
630634
expect(await page.textContent('h1')).toBe('42');
631635

pnpm-lock.yaml

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
"check": {
3131
"dependsOn": ["prepare"],
3232
"inputs": [
33+
"index.js",
34+
"index.d.ts",
35+
"ambient.d.ts",
3336
"src/**",
3437
"types/**",
3538
".svelte-kit/types/**",

0 commit comments

Comments
 (0)