From 21eaa08017635a404d6ac777a2099c496e3aeb6a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 22 Apr 2024 15:25:21 -0400 Subject: [PATCH] fix some tests --- packages/svelte/messages/compile-errors/css.md | 4 ++-- packages/svelte/messages/compile-errors/parse.md | 2 +- packages/svelte/messages/compile-errors/runes.md | 4 ++-- packages/svelte/src/compiler/errors.js | 8 ++++---- .../svelte/src/compiler/phases/1-parse/index.js | 2 +- .../src/compiler/phases/1-parse/state/element.js | 4 ++-- .../src/compiler/phases/2-analyze/validation.js | 7 +++++-- .../samples/attribute-empty/_config.js | 2 +- .../attribute-sequence-expression-2/_config.js | 2 +- .../attribute-sequence-expression/_config.js | 2 +- .../samples/attribute-unique-binding/_config.js | 2 +- .../samples/attribute-unique-shorthand/_config.js | 2 +- .../samples/attribute-unique/_config.js | 2 +- .../samples/catch-before-closing/_config.js | 2 +- .../samples/catch-without-await/_config.js | 2 +- .../samples/class-state-field-static/_config.js | 5 +++-- .../samples/comment-unclosed/_config.js | 4 ++-- .../component-slot-duplicate-error-2/_config.js | 2 +- .../component-slot-duplicate-error-3/_config.js | 2 +- .../component-slot-duplicate-error-4/_config.js | 2 +- .../component-slot-duplicate-error-5/_config.js | 2 +- .../component-slot-duplicate-error-6/_config.js | 2 +- .../component-slot-duplicate-error/_config.js | 2 +- .../component-slot-nested-error-2/_config.js | 2 +- .../component-slot-nested-error-3/_config.js | 2 +- .../samples/component-slot-nested-error/_config.js | 2 +- .../samples/css-global-block-combinator/_config.js | 2 +- .../css-global-block-declaration/_config.js | 2 +- .../samples/css-global-block-modifier/_config.js | 2 +- .../samples/css-global-block-multiple/_config.js | 2 +- .../tests/compiler-errors/samples/css/_config.js | 2 +- .../samples/dollar-binding-declaration/_config.js | 2 +- .../samples/dollar-binding-global-js/_config.js | 4 ++-- .../samples/dollar-binding-global/_config.js | 4 ++-- .../samples/dollar-binding-import/_config.js | 2 +- .../dynamic-element-binding-invalid/_config.js | 4 ++-- .../samples/else-before-closing-2/_config.js | 2 +- .../samples/else-before-closing-3/_config.js | 2 +- .../samples/else-before-closing/_config.js | 2 +- .../samples/else-if-before-closing-2/_config.js | 2 +- .../samples/else-if-before-closing/_config.js | 2 +- .../samples/else-if-without-if/_config.js | 2 +- .../samples/empty-attribute-shorthand/_config.js | 2 +- .../samples/empty-classname-binding/_config.js | 2 +- .../samples/empty-directive-name/_config.js | 2 +- .../samples/export-derived-state/_config.js | 2 +- .../samples/export-state-module/_config.js | 2 +- .../samples/export-state/_config.js | 2 +- .../samples/illegal-expression/_config.js | 2 +- .../samples/invalid-snippet-binding/_config.js | 2 +- .../samples/invalid-snippet-mutation/_config.js | 2 +- .../samples/legacy-no-const-assignment/_config.js | 4 ++-- .../samples/legacy-no-const-update/_config.js | 4 ++-- .../samples/multiple-styles/_config.js | 4 ++-- .../samples/options-children/_config.js | 2 +- .../samples/raw-mustaches-whitespace/_config.js | 2 +- .../samples/render-tag-invalid-call/_config.js | 2 +- .../samples/runes-before-after-update/_config.js | 2 +- .../samples/runes-duplicate-props/_config.js | 4 ++-- .../samples/runes-export-let/_config.js | 2 +- .../samples/runes-export-named-state/_config.js | 2 +- .../samples/runes-invalid-each-binding/_config.js | 4 ++-- .../samples/runes-invalid-each-mutation/_config.js | 4 ++-- .../samples/runes-no-const-assignment/_config.js | 4 ++-- .../samples/runes-no-const-update/_config.js | 4 ++-- .../samples/runes-no-derived-assignment/_config.js | 4 ++-- .../samples/runes-no-derived-binding/_config.js | 4 ++-- .../_config.js | 4 ++-- .../runes-no-derived-state-field-update/_config.js | 4 ++-- .../samples/runes-no-derived-update/_config.js | 4 ++-- .../samples/runes-no-rune-each/_config.js | 4 ++-- .../samples/runes-prop-export-conflict/_config.js | 2 +- .../samples/runes-wrong-bindable-args/_config.js | 4 ++-- .../runes-wrong-bindable-placement/_config.js | 4 ++-- .../samples/runes-wrong-derived-args/_config.js | 4 ++-- .../runes-wrong-derived-placement/_config.js | 5 +++-- .../samples/runes-wrong-effect-args/_config.js | 4 ++-- .../runes-wrong-effect-placement/_config.js | 4 ++-- .../samples/runes-wrong-host-placement/_config.js | 4 ++-- .../samples/runes-wrong-props-args/_config.js | 4 ++-- .../samples/runes-wrong-props-placement/_config.js | 4 ++-- .../samples/runes-wrong-state-args/_config.js | 4 ++-- .../samples/runes-wrong-state-placement/_config.js | 4 ++-- .../runes-wrong-state-snapshot-args/_config.js | 4 ++-- .../samples/script-unclosed-eof/_config.js | 2 +- .../samples/script-unclosed/_config.js | 4 ++-- .../samples/self-reference/_config.js | 4 ++-- .../slot-conflicting-with-render-tag/_config.js | 4 ++-- .../samples/snippet-children-conflict/_config.js | 2 +- .../store-autosub-context-module/_config.js | 4 ++-- .../samples/store-contextual/_config.js | 2 +- .../samples/store-global-disallowed/_config.js | 4 ++-- .../store-prevent-user-declarations/_config.js | 2 +- .../samples/store-shadow-scope-2/_config.js | 2 +- .../samples/store-shadow-scope-3/_config.js | 2 +- .../samples/store-shadow-scope/_config.js | 2 +- .../store-template-expression-scope/_config.js | 2 +- .../samples/style-unclosed-eof/_config.js | 2 +- .../samples/style-unclosed/_config.js | 2 +- .../samples/svelte-selfdestructive/_config.js | 4 ++-- .../samples/then-before-closing/_config.js | 2 +- .../samples/then-without-await/_config.js | 2 +- .../unclosed-attribute-self-close-tag/_config.js | 2 +- .../samples/unexpected-end-of-input-b/_config.js | 2 +- .../samples/unexpected-end-of-input-c/_config.js | 2 +- .../samples/unexpected-end-of-input/_config.js | 2 +- .../unmatched-closing-tag-autoclose-2/_config.js | 2 +- .../unmatched-closing-tag-autoclose/_config.js | 2 +- .../samples/unmatched-closing-tag/_config.js | 2 +- .../samples/void-closing/_config.js | 2 +- .../samples/window-children/_config.js | 2 +- .../samples/window-duplicate/_config.js | 2 +- .../samples/window-inside-block/_config.js | 2 +- .../samples/window-inside-element/_config.js | 2 +- .../samples/action-on-component/errors.json | 2 +- .../samples/animation-duplicate/errors.json | 2 +- .../samples/animation-not-in-each/errors.json | 2 +- .../animation-not-in-keyed-each/errors.json | 2 +- .../samples/animation-on-component/errors.json | 2 +- .../samples/animation-siblings/errors.json | 2 +- .../samples/assignment-to-const-2/errors.json | 4 ++-- .../samples/assignment-to-const-3/errors.json | 4 ++-- .../samples/assignment-to-const-4/errors.json | 4 ++-- .../samples/assignment-to-const-5/errors.json | 4 ++-- .../samples/assignment-to-const-7/errors.json | 4 ++-- .../samples/assignment-to-const/errors.json | 4 ++-- .../samples/attribute-expected-equals/errors.json | 2 +- .../samples/attribute-invalid-name-2/errors.json | 2 +- .../samples/attribute-invalid-name-3/errors.json | 2 +- .../samples/attribute-invalid-name-4/errors.json | 2 +- .../samples/attribute-invalid-name-5/errors.json | 2 +- .../samples/attribute-invalid-name/errors.json | 2 +- .../samples/binding-await-catch/errors.json | 12 +++++++++--- .../samples/binding-await-then-2/errors.json | 12 +++++++++--- .../samples/binding-await-then/errors.json | 12 +++++++++--- .../validator/samples/binding-const/errors.json | 2 +- .../samples/binding-dimensions-svg/errors.json | 4 ++-- .../samples/binding-input-checked/errors.json | 4 ++-- .../samples/binding-input-type-boolean/errors.json | 2 +- .../binding-invalid-foreign-namespace/errors.json | 2 +- .../binding-invalid-on-element-2/errors.json | 4 ++-- .../samples/binding-invalid-on-element/errors.json | 4 ++-- .../binding-invalid-value-global/errors.json | 2 +- .../samples/binding-invalid-value/errors.json | 2 +- .../validator/samples/binding-invalid/errors.json | 2 +- .../validator/samples/binding-let/errors.json | 2 +- .../binding-select-multiple-dynamic/errors.json | 2 +- .../component-event-modifiers-invalid/errors.json | 2 +- .../component-invalid-style-directive/errors.json | 12 +++++++++--- .../component-slot-default-reserved/errors.json | 2 +- .../component-slot-dynamic-attribute/errors.json | 2 +- .../samples/component-slot-dynamic/errors.json | 2 +- .../component-slotted-custom-element-2/errors.json | 12 +++++++++--- .../component-slotted-each-block/errors.json | 2 +- .../samples/component-slotted-if-block/errors.json | 2 +- .../samples/const-tag-conflict-1/errors.json | 12 +++++++++--- .../samples/const-tag-conflict-2/errors.json | 12 +++++++++--- .../samples/const-tag-placement-1/errors.json | 12 +++++++++--- .../samples/const-tag-placement-2/errors.json | 12 +++++++++--- .../samples/const-tag-readonly-1/errors.json | 14 ++++++++++---- .../samples/const-tag-readonly-2/errors.json | 12 +++++++++--- .../samples/contenteditable-dynamic/errors.json | 2 +- .../samples/contenteditable-missing/errors.json | 2 +- .../css-invalid-combinator-selector-1/errors.json | 2 +- .../css-invalid-combinator-selector-2/errors.json | 2 +- .../css-invalid-combinator-selector-3/errors.json | 2 +- .../css-invalid-combinator-selector-4/errors.json | 2 +- .../css-invalid-global-placement-2/errors.json | 2 +- .../css-invalid-global-placement-3/errors.json | 2 +- .../css-invalid-global-placement-4/errors.json | 2 +- .../css-invalid-global-placement-5/errors.json | 2 +- .../css-invalid-global-placement-6/errors.json | 2 +- .../css-invalid-global-placement/errors.json | 2 +- .../css-invalid-global-selector-2/errors.json | 2 +- .../css-invalid-global-selector-3/errors.json | 2 +- .../css-invalid-global-selector-4/errors.json | 2 +- .../css-invalid-global-selector-5/errors.json | 2 +- .../css-invalid-global-selector-6/errors.json | 2 +- .../css-invalid-global-selector-list/errors.json | 2 +- .../css-invalid-global-selector/errors.json | 2 +- .../errors.json | 2 +- .../samples/css-mismatched-quotes/errors.json | 2 +- .../samples/debug-invalid-args/errors.json | 2 +- .../default-export-anonymous-class/errors.json | 2 +- .../default-export-anonymous-function/errors.json | 2 +- .../validator/samples/default-export/errors.json | 2 +- .../samples/directive-non-expression/errors.json | 2 +- .../dollar-dollar-global-in-markup/errors.json | 2 +- .../dollar-dollar-global-in-script/errors.json | 2 +- .../samples/dollar-global-in-markup/errors.json | 2 +- .../samples/dollar-global-in-script/errors.json | 2 +- .../dynamic-element-invalid-tag/errors.json | 2 +- .../dynamic-element-missing-tag/errors.json | 2 +- .../samples/dynamic-element-this/errors.json | 2 +- .../errors.json | 2 +- .../errors.json | 2 +- .../errors.json | 2 +- .../samples/each-block-invalid-context/errors.json | 2 +- .../validator/samples/event-attribute/errors.json | 2 +- .../event-modifiers-invalid-nonpassive/errors.json | 2 +- .../event-modifiers-invalid-passive/errors.json | 2 +- .../samples/event-modifiers-invalid/errors.json | 2 +- .../samples/html-block-in-attribute/errors.json | 12 +++++++++--- .../samples/html-block-in-textarea/errors.json | 12 +++++++++--- .../illegal-variable-declaration/errors.json | 2 +- .../invalid-empty-css-declaration/errors.json | 2 +- .../samples/invalid-node-placement-2/errors.json | 2 +- .../samples/invalid-node-placement/errors.json | 2 +- .../validator/samples/let-directive/errors.json | 12 +++++++++--- .../samples/logic-block-in-attribute/errors.json | 12 +++++++++--- .../samples/logic-block-in-textarea/errors.json | 12 +++++++++--- .../multiple-script-default-context/errors.json | 2 +- .../multiple-script-module-context/errors.json | 2 +- .../samples/namespace-invalid/errors.json | 2 +- .../samples/namespace-non-literal/errors.json | 2 +- .../reactive-declaration-cyclical/errors.json | 12 +++++++++--- .../samples/script-invalid-context/errors.json | 2 +- .../samples/slot-attribute-invalid/errors.json | 2 +- .../style-directive-modifiers-invalid/errors.json | 2 +- .../svelte-fragment-placement-2/errors.json | 12 +++++++++--- .../samples/svelte-fragment-placement/errors.json | 12 +++++++++--- .../samples/svelte-head-attributes/errors.json | 12 +++++++++--- .../validator/samples/tag-invalid/errors.json | 2 +- .../validator/samples/tag-non-string/errors.json | 2 +- .../samples/textarea-value-children/errors.json | 2 +- .../samples/title-no-attributes/errors.json | 2 +- .../samples/title-no-children/errors.json | 2 +- .../transition-duplicate-in-transition/errors.json | 2 +- .../samples/transition-duplicate-in/errors.json | 2 +- .../errors.json | 2 +- .../samples/transition-duplicate-out/errors.json | 2 +- .../transition-duplicate-transition-in/errors.json | 2 +- .../errors.json | 2 +- .../transition-duplicate-transition/errors.json | 2 +- .../samples/transition-on-component/errors.json | 2 +- .../window-binding-invalid-innerwidth/errors.json | 2 +- .../samples/window-binding-invalid/errors.json | 2 +- 237 files changed, 457 insertions(+), 332 deletions(-) diff --git a/packages/svelte/messages/compile-errors/css.md b/packages/svelte/messages/compile-errors/css.md index 440f7f7b28..02acd29e5a 100644 --- a/packages/svelte/messages/compile-errors/css.md +++ b/packages/svelte/messages/compile-errors/css.md @@ -44,7 +44,7 @@ Invalid selector ## invalid_css_identifier -TODO +Expected a valid CSS identifier ## invalid_nesting_selector @@ -52,4 +52,4 @@ Nesting selectors can only be used inside a rule ## invalid_css_declaration -TODO \ No newline at end of file +TODO diff --git a/packages/svelte/messages/compile-errors/parse.md b/packages/svelte/messages/compile-errors/parse.md index da250c92cd..e09c61e419 100644 --- a/packages/svelte/messages/compile-errors/parse.md +++ b/packages/svelte/messages/compile-errors/parse.md @@ -1,6 +1,6 @@ ## unclosed_element -%name% was left open +`<%name%>` was left open ## unclosed_block diff --git a/packages/svelte/messages/compile-errors/runes.md b/packages/svelte/messages/compile-errors/runes.md index 33d9280cc2..c8efa4eefb 100644 --- a/packages/svelte/messages/compile-errors/runes.md +++ b/packages/svelte/messages/compile-errors/runes.md @@ -56,11 +56,11 @@ Cannot export derived state from a module. To expose the current derived value, ## invalid_assignment -Cannot assign to `%thing%` +Cannot assign to %thing% ## invalid_binding -Cannot bind to `%thing%` +Cannot bind to %thing% ## invalid_rune_args diff --git a/packages/svelte/src/compiler/errors.js b/packages/svelte/src/compiler/errors.js index 870c2581c2..0dfee4ec16 100644 --- a/packages/svelte/src/compiler/errors.js +++ b/packages/svelte/src/compiler/errors.js @@ -418,7 +418,7 @@ export function invalid_css_selector(node) { * @returns {never} */ export function invalid_css_identifier(node) { - e(node, "invalid_css_identifier", "TODO"); + e(node, "invalid_css_identifier", "Expected a valid CSS identifier"); } /** @@ -518,7 +518,7 @@ export function cyclical_reactive_declaration(node, cycle) { * @returns {never} */ export function unclosed_element(node, name) { - e(node, "unclosed_element", `${name} was left open`); + e(node, "unclosed_element", `\`<${name}>\` was left open`); } /** @@ -981,7 +981,7 @@ export function invalid_host_location(node) { * @returns {never} */ export function invalid_assignment(node, thing) { - e(node, "invalid_assignment", `Cannot assign to \`${thing}\``); + e(node, "invalid_assignment", `Cannot assign to ${thing}`); } /** @@ -990,7 +990,7 @@ export function invalid_assignment(node, thing) { * @returns {never} */ export function invalid_binding(node, thing) { - e(node, "invalid_binding", `Cannot bind to \`${thing}\``); + e(node, "invalid_binding", `Cannot bind to ${thing}`); } /** diff --git a/packages/svelte/src/compiler/phases/1-parse/index.js b/packages/svelte/src/compiler/phases/1-parse/index.js index 0982f4a960..d5f5cda052 100644 --- a/packages/svelte/src/compiler/phases/1-parse/index.js +++ b/packages/svelte/src/compiler/phases/1-parse/index.js @@ -92,7 +92,7 @@ export class Parser { if (current.type === 'RegularElement') { current.end = current.start + 1; - e.unclosed_element(current, `<${current.name}>`); + e.unclosed_element(current, current.name); } else { current.end = current.start + 1; e.unclosed_block(current); diff --git a/packages/svelte/src/compiler/phases/1-parse/state/element.js b/packages/svelte/src/compiler/phases/1-parse/state/element.js index 811cf6a218..78988af6d1 100644 --- a/packages/svelte/src/compiler/phases/1-parse/state/element.js +++ b/packages/svelte/src/compiler/phases/1-parse/state/element.js @@ -677,7 +677,7 @@ function read_attribute_value(parser) { 'in attribute value' ); } catch (/** @type {any} */ error) { - if (error.code === 'js-parse-error') { + if (error.code === 'js_parse_error') { // if the attribute value didn't close + self-closing tag // eg: `` // acorn may throw a `Unterminated regular expression` because of `/>` @@ -687,7 +687,7 @@ function read_attribute_value(parser) { e.unclosed_attribute_value(pos, quote_mark || '}'); } } - throw e; + throw error; } if (value.length === 0 && !quote_mark) { diff --git a/packages/svelte/src/compiler/phases/2-analyze/validation.js b/packages/svelte/src/compiler/phases/2-analyze/validation.js index 8d7e6348c5..7a416a2af0 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/validation.js +++ b/packages/svelte/src/compiler/phases/2-analyze/validation.js @@ -1023,10 +1023,13 @@ function validate_no_const_assignment(node, argument, scope, is_binding) { // (binding.kind !== 'normal' || !binding.initial) // ); + // TODO have a more specific error message for assignments to things like `{:then foo}` + const thing = 'constant'; + if (is_binding) { - e.invalid_binding(node, 'TODO'); + e.invalid_binding(node, thing); } else { - e.invalid_assignment(node, 'TODO'); + e.invalid_assignment(node, thing); } } } diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-empty/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-empty/_config.js index 248fc1107e..9c29f505ee 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-empty/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-empty/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'missing-attribute-value', + code: 'missing_attribute_value', message: 'Expected attribute value', position: [12, 12] } diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression-2/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression-2/_config.js index 5fc3e7b5fa..e655d40aae 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression-2/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression-2/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-sequence-expression', + code: 'invalid_sequence_expression', message: 'Sequence expressions are not allowed as attribute/directive values in runes mode, unless wrapped in parentheses', position: [124, 131] diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression/_config.js index 79ddec267b..15549974d3 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-sequence-expression/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-sequence-expression', + code: 'invalid_sequence_expression', message: 'Sequence expressions are not allowed as attribute/directive values in runes mode, unless wrapped in parentheses', position: [163, 170] diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-unique-binding/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-unique-binding/_config.js index e933cebbf5..5fb31858b7 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-unique-binding/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-unique-binding/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-attribute', + code: 'duplicate_attribute', message: 'Attributes need to be unique', position: [17, 17] } diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-unique-shorthand/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-unique-shorthand/_config.js index e933cebbf5..5fb31858b7 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-unique-shorthand/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-unique-shorthand/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-attribute', + code: 'duplicate_attribute', message: 'Attributes need to be unique', position: [17, 17] } diff --git a/packages/svelte/tests/compiler-errors/samples/attribute-unique/_config.js b/packages/svelte/tests/compiler-errors/samples/attribute-unique/_config.js index e933cebbf5..5fb31858b7 100644 --- a/packages/svelte/tests/compiler-errors/samples/attribute-unique/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/attribute-unique/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-attribute', + code: 'duplicate_attribute', message: 'Attributes need to be unique', position: [17, 17] } diff --git a/packages/svelte/tests/compiler-errors/samples/catch-before-closing/_config.js b/packages/svelte/tests/compiler-errors/samples/catch-before-closing/_config.js index 1a50076da4..52786af6d8 100644 --- a/packages/svelte/tests/compiler-errors/samples/catch-before-closing/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/catch-before-closing/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'expected-token', + code: 'expected_token', message: 'Expected token {:else}', position: [35, 35] } diff --git a/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js b/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js index 64c85f85c9..b24874f1b4 100644 --- a/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-continuing-block-placement', + code: 'invalid_continuing_block_placement', message: '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', position: [1, 1] diff --git a/packages/svelte/tests/compiler-errors/samples/class-state-field-static/_config.js b/packages/svelte/tests/compiler-errors/samples/class-state-field-static/_config.js index dca19b4606..d212e197f0 100644 --- a/packages/svelte/tests/compiler-errors/samples/class-state-field-static/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/class-state-field-static/_config.js @@ -2,8 +2,9 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-state-location', - message: '$state(...) can only be used as a variable declaration initializer or a class field', + code: 'invalid_state_location', + message: + '`$state(...)` can only be used as a variable declaration initializer or a class field', position: [33, 41] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/comment-unclosed/_config.js b/packages/svelte/tests/compiler-errors/samples/comment-unclosed/_config.js index 7c00375ad6..38bc06f415 100644 --- a/packages/svelte/tests/compiler-errors/samples/comment-unclosed/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/comment-unclosed/_config.js @@ -2,8 +2,8 @@ import { test } from '../../test'; export default test({ error: { - code: 'unexpected-eof', - message: 'Unexpected end of input (expected -->)', + code: 'expected_token', + message: 'Expected token -->', position: [24, 24] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-2/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-2/_config.js index 0085693908..2dafcd66b1 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-2/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-2/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-slot-name', + code: 'duplicate_slot_name', message: "Duplicate slot name 'foo' in " } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-3/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-3/_config.js index 0085693908..2dafcd66b1 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-3/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-3/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-slot-name', + code: 'duplicate_slot_name', message: "Duplicate slot name 'foo' in " } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-4/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-4/_config.js index 78e10808bd..1a8d68c564 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-4/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-4/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-default-slot-content', + code: 'invalid_default_slot_content', message: 'Found default slot content alongside an explicit slot="default"' } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-5/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-5/_config.js index 0085693908..2dafcd66b1 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-5/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-5/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-slot-name', + code: 'duplicate_slot_name', message: "Duplicate slot name 'foo' in " } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-6/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-6/_config.js index 0085693908..2dafcd66b1 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-6/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error-6/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-slot-name', + code: 'duplicate_slot_name', message: "Duplicate slot name 'foo' in " } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error/_config.js index 0085693908..2dafcd66b1 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-duplicate-error/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'duplicate-slot-name', + code: 'duplicate_slot_name', message: "Duplicate slot name 'foo' in " } }); diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-2/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-2/_config.js index 69c2adb23c..727e0c8bda 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-2/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-2/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-slot-placement', + code: 'invalid_slot_placement', message: "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" } diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-3/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-3/_config.js index 69c2adb23c..727e0c8bda 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-3/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error-3/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-slot-placement', + code: 'invalid_slot_placement', message: "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" } diff --git a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error/_config.js b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error/_config.js index 69c2adb23c..727e0c8bda 100644 --- a/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/component-slot-nested-error/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-slot-placement', + code: 'invalid_slot_placement', message: "Element with a slot='...' attribute must be a child of a component or a descendant of a custom element" } diff --git a/packages/svelte/tests/compiler-errors/samples/css-global-block-combinator/_config.js b/packages/svelte/tests/compiler-errors/samples/css-global-block-combinator/_config.js index 6a11aa63ec..77baf5a87e 100644 --- a/packages/svelte/tests/compiler-errors/samples/css-global-block-combinator/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/css-global-block-combinator/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-css-global-block-combinator', + code: 'invalid_css_global_block_combinator', message: 'A :global {...} block cannot follow a > combinator', position: [12, 21] } diff --git a/packages/svelte/tests/compiler-errors/samples/css-global-block-declaration/_config.js b/packages/svelte/tests/compiler-errors/samples/css-global-block-declaration/_config.js index 7b637ca42e..5d2a52465f 100644 --- a/packages/svelte/tests/compiler-errors/samples/css-global-block-declaration/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/css-global-block-declaration/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-css-global-block-declaration', + code: 'invalid_css_global_block_declaration', message: 'A :global {...} block can only contain rules, not declarations', position: [24, 34] } diff --git a/packages/svelte/tests/compiler-errors/samples/css-global-block-modifier/_config.js b/packages/svelte/tests/compiler-errors/samples/css-global-block-modifier/_config.js index 9e7cac667f..63b20e7e36 100644 --- a/packages/svelte/tests/compiler-errors/samples/css-global-block-modifier/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/css-global-block-modifier/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-css-global-block-modifier', + code: 'invalid_css_global_block_modifier', message: 'A :global {...} block cannot modify an existing selector', position: [14, 21] } diff --git a/packages/svelte/tests/compiler-errors/samples/css-global-block-multiple/_config.js b/packages/svelte/tests/compiler-errors/samples/css-global-block-multiple/_config.js index 8021a9c677..bb189b05f5 100644 --- a/packages/svelte/tests/compiler-errors/samples/css-global-block-multiple/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/css-global-block-multiple/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-css-global-block-list', + code: 'invalid_css_global_block_list', message: 'A :global {...} block cannot be part of a selector list with more than one item', position: [9, 31] } diff --git a/packages/svelte/tests/compiler-errors/samples/css/_config.js b/packages/svelte/tests/compiler-errors/samples/css/_config.js index 9705cde6b5..74ef4c9c6c 100644 --- a/packages/svelte/tests/compiler-errors/samples/css/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/css/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-css-identifier', + code: 'invalid_css_identifier', message: 'Expected a valid CSS identifier', position: [25, 25] } diff --git a/packages/svelte/tests/compiler-errors/samples/dollar-binding-declaration/_config.js b/packages/svelte/tests/compiler-errors/samples/dollar-binding-declaration/_config.js index a49d35d090..7141ff1efd 100644 --- a/packages/svelte/tests/compiler-errors/samples/dollar-binding-declaration/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/dollar-binding-declaration/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-dollar-binding', + code: 'invalid_dollar_binding', message: 'The $ name is reserved, and cannot be used for variables and imports' } }); diff --git a/packages/svelte/tests/compiler-errors/samples/dollar-binding-global-js/_config.js b/packages/svelte/tests/compiler-errors/samples/dollar-binding-global-js/_config.js index 666b798323..ae86ca8d6b 100644 --- a/packages/svelte/tests/compiler-errors/samples/dollar-binding-global-js/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/dollar-binding-global-js/_config.js @@ -2,8 +2,8 @@ import { test } from '../../test'; export default test({ error: { - code: 'illegal-global', + code: 'illegal_global', message: - '$ is an illegal variable name. To reference a global variable called $, use globalThis.$' + '`$` is an illegal variable name. To reference a global variable called `$`, use `globalThis.$`' } }); diff --git a/packages/svelte/tests/compiler-errors/samples/dollar-binding-global/_config.js b/packages/svelte/tests/compiler-errors/samples/dollar-binding-global/_config.js index 666b798323..ae86ca8d6b 100644 --- a/packages/svelte/tests/compiler-errors/samples/dollar-binding-global/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/dollar-binding-global/_config.js @@ -2,8 +2,8 @@ import { test } from '../../test'; export default test({ error: { - code: 'illegal-global', + code: 'illegal_global', message: - '$ is an illegal variable name. To reference a global variable called $, use globalThis.$' + '`$` is an illegal variable name. To reference a global variable called `$`, use `globalThis.$`' } }); diff --git a/packages/svelte/tests/compiler-errors/samples/dollar-binding-import/_config.js b/packages/svelte/tests/compiler-errors/samples/dollar-binding-import/_config.js index a49d35d090..7141ff1efd 100644 --- a/packages/svelte/tests/compiler-errors/samples/dollar-binding-import/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/dollar-binding-import/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-dollar-binding', + code: 'invalid_dollar_binding', message: 'The $ name is reserved, and cannot be used for variables and imports' } }); diff --git a/packages/svelte/tests/compiler-errors/samples/dynamic-element-binding-invalid/_config.js b/packages/svelte/tests/compiler-errors/samples/dynamic-element-binding-invalid/_config.js index 6934ea4c55..4bb3edc27b 100644 --- a/packages/svelte/tests/compiler-errors/samples/dynamic-element-binding-invalid/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/dynamic-element-binding-invalid/_config.js @@ -2,7 +2,7 @@ import { test } from '../../test'; export default test({ error: { - code: 'invalid-binding', - message: "'value' binding can only be used with ,