Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] upgrade to playwright 1.28.1 #7696

Merged
merged 12 commits into from Nov 28, 2022
5 changes: 5 additions & 0 deletions .changeset/nine-rivers-argue.md
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Upgrade to Playwright 1.28.1
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -27,7 +27,7 @@
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
"playwright": "1.25.0",
"playwright": "^1.28.1",
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"svelte": "^3.52.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/package.json
Expand Up @@ -15,7 +15,7 @@
"prompts": "^2.4.2"
},
"devDependencies": {
"@playwright/test": "1.25.0",
"@playwright/test": "^1.28.1",
"@sveltejs/kit": "workspace:*",
"@types/gitignore-parser": "^0.0.0",
"@types/prettier": "^2.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Expand Up @@ -24,7 +24,7 @@
"undici": "5.12.0"
},
"devDependencies": {
"@playwright/test": "1.25.0",
"@playwright/test": "^1.28.1",
"@types/connect": "^3.4.35",
"@types/marked": "^4.0.7",
"@types/mime": "^3.0.1",
Expand Down
7 changes: 6 additions & 1 deletion packages/kit/src/runtime/client/fetcher.js
Expand Up @@ -26,7 +26,12 @@ if (import.meta.env.DEV) {
const url = input instanceof Request ? input.url : input.toString();
const stack = /** @type {string} */ (new Error().stack);

const heuristic = can_inspect_stack_trace ? stack.includes('load_node') : loading;
// check if fetch was called via load_node. the lock method only checks if it was called at the
// same time, but not necessarily if it was called from `load`
// we use just the filename as the method name sometimes does not appear on the CI
const heuristic = can_inspect_stack_trace
? stack.includes('src/runtime/client/client.js')
: loading;
Comment on lines +29 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an async thing? because can_inspect_stack_trace works by checking to see if a newly created stack trace includes the check_stack_trace function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. load is contained in the stack trace, but not the others:

@http://localhost:5173/@fs/Users/runner/work/kit/kit/packages/kit/src/runtime/client/fetcher.js:26:49
@http://localhost:5173/src/routes/load/window-fetch/incorrect/+page.js:3:25
load@http://localhost:5173/src/routes/load/window-fetch/incorrect/+page.js:2:28
@http://localhost:5173/@fs/Users/runner/work/kit/kit/packages/kit/src/runtime/client/client.js:653:41

I'm on mobile at the moment so can't easily check whether that's because of async or not, but I'm not sure it'd change the fix? It would be interesting to know though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, it's not related to async vs sync. load is async and showed up in the stack trace, but the lines before and after are async and the methods didn't show up there.

if (heuristic) {
console.warn(
`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`
Expand Down
24 changes: 14 additions & 10 deletions packages/kit/test/apps/basics/test/client.test.js
Expand Up @@ -608,24 +608,28 @@ test.describe('Load', () => {

if (process.env.DEV) {
test('using window.fetch causes a warning', async ({ page, baseURL }) => {
await Promise.all([
page.goto('/load/window-fetch/incorrect'),
page.waitForEvent('console', {
predicate: (message) => {
return (
message.text() ===
`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`
);
},
timeout: 3_000
})
]);
expect(await page.textContent('h1')).toBe('42');

/** @type {string[]} */
const warnings = [];

page.on('console', (msg) => {
if (msg.type() === 'warning') {
warnings.push(msg.text());
}
});

await page.goto('/load/window-fetch/incorrect');
expect(await page.textContent('h1')).toBe('42');

expect(warnings).toContain(
`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`
);

warnings.length = 0;

await page.goto('/load/window-fetch/correct');
expect(await page.textContent('h1')).toBe('42');

Expand Down
44 changes: 14 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.