Skip to content

Commit 68281fa

Browse files
committed
more test fixes
1 parent 969da7f commit 68281fa

File tree

8 files changed

+45
-10
lines changed

8 files changed

+45
-10
lines changed

packages/svelte/src/internal/shared/clone.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ test('uncloneable value', () => {
126126

127127
assert.equal(fn, copy);
128128
assert.deepEqual(warnings(), [
129-
'%c[svelte] state_snapshot_uncloneable\n%cValue cannot be cloned with `$state.snapshot` — the original value was returned'
129+
'%c[svelte] state_snapshot_uncloneable\n%cValue cannot be cloned with `$state.snapshot` — the original value was returned\nhttps://svelte.dev/e/state_snapshot_uncloneable'
130130
]);
131131
});
132132

@@ -160,7 +160,8 @@ test('uncloneable properties', () => {
160160
- <value>.c[4]
161161
- <value>.c[5]
162162
- <value>.c[6]
163-
- <value>.c[7]`
163+
- <value>.c[7]
164+
https://svelte.dev/e/state_snapshot_uncloneable`
164165
]);
165166
});
166167

@@ -181,6 +182,7 @@ test('many uncloneable properties', () => {
181182
- <value>[4]
182183
- <value>[5]
183184
- <value>[6]
184-
- ...and 93 more`
185+
- ...and 93 more
186+
https://svelte.dev/e/state_snapshot_uncloneable`
185187
]);
186188
});

packages/svelte/tests/compiler-errors/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface CompilerErrorTest extends BaseTest {
1313
}
1414

1515
/**
16-
* Remove the "See https://svelte.dev/e/..." link
16+
* Remove the "https://svelte.dev/e/..." link
1717
*/
1818
function strip_link(message: string) {
1919
return message.slice(0, message.lastIndexOf('\n'));

packages/svelte/tests/css/test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ function normalize_warning(warning: Warning) {
1212
delete warning.filename;
1313
delete warning.position;
1414
delete warning.frame;
15+
16+
// Remove the "https://svelte.dev/e/..." link at the end
17+
const lines = warning.message.split('\n');
18+
if (lines.at(-1)?.startsWith('https://svelte.dev/e/')) {
19+
lines.pop();
20+
}
21+
warning.message = lines.join('\n');
22+
1523
return warning;
1624
}
1725

@@ -28,6 +36,13 @@ interface CssTest extends BaseTest {
2836
props?: Record<string, any>;
2937
}
3038

39+
/**
40+
* Remove the "https://svelte.dev/e/..." link
41+
*/
42+
function strip_link(message: string) {
43+
return message.slice(0, message.lastIndexOf('\n'));
44+
}
45+
3146
const { test, run } = suite<CssTest>(async (config, cwd) => {
3247
await compile_directory(cwd, 'client', { cssHash: () => 'svelte-xyz', ...config.compileOptions });
3348
await compile_directory(cwd, 'server', { cssHash: () => 'svelte-xyz', ...config.compileOptions });

packages/svelte/tests/hydration/test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ const { test, run } = suite<HydrationTest>(async (config, cwd) => {
7777
// TODO convert this to structured data, for more robust comparison?
7878
const text = args[0];
7979
const code = text.slice(11, text.indexOf('\n%c', 11));
80-
const message = text.slice(text.indexOf('%c', 2) + 2);
80+
let message = text.slice(text.indexOf('%c', 2) + 2);
81+
82+
// Remove the "https://svelte.dev/e/..." link at the end
83+
const lines = message.split('\n');
84+
if (lines.at(-1)?.startsWith('https://svelte.dev/e/')) {
85+
lines.pop();
86+
}
87+
message = lines.join('\n');
8188

8289
if (typeof message === 'string' && code === 'hydration_mismatch') {
8390
got_hydration_error = true;

packages/svelte/tests/migrate/samples/impossible-migrate-with-errors/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default test({
1818
2:
1919
3: unterminated template
2020
^`,
21-
message: 'Unexpected end of input',
21+
message: 'Unexpected end of input\nhttps://svelte.dev/e/unexpected_eof',
2222
position: [30, 30],
2323
start: {
2424
character: 30,

packages/svelte/tests/runtime-browser/custom-elements-samples/extended-builtin/_config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export default test({
55
warnings: [
66
{
77
code: 'attribute_avoid_is',
8-
message: 'The "is" attribute is not supported cross-browser and should be avoided',
8+
message:
9+
'The "is" attribute is not supported cross-browser and should be avoided\nhttps://svelte.dev/e/attribute_avoid_is',
910
start: {
1011
character: 109,
1112
column: 8,

packages/svelte/tests/runtime-legacy/shared.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,18 @@ async function run_test_variant(
216216
console.warn = (...args) => {
217217
if (args[0].startsWith('%c[svelte]')) {
218218
// TODO convert this to structured data, for more robust comparison?
219-
const message = args[0];
220-
warnings.push(message.slice(message.indexOf('%c', 2) + 2));
219+
220+
let message = args[0];
221+
message = message.slice(message.indexOf('%c', 2) + 2);
222+
223+
// Remove the "https://svelte.dev/e/..." link at the end
224+
const lines = message.split('\n');
225+
if (lines.at(-1)?.startsWith('https://svelte.dev/e/')) {
226+
lines.pop();
227+
}
228+
message = lines.join('\n');
229+
230+
warnings.push(message);
221231
} else {
222232
warnings.push(...args);
223233
}

packages/svelte/tests/validator/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ValidatorTest extends BaseTest {
1414
}
1515

1616
/**
17-
* Remove the "See https://svelte.dev/e/..." link
17+
* Remove the "https://svelte.dev/e/..." link
1818
*/
1919
function strip_link(message: string) {
2020
return message.slice(0, message.lastIndexOf('\n'));

0 commit comments

Comments
 (0)