mirror of
https://github.com/zhigang1992/esbuild.git
synced 2026-04-30 10:22:49 +08:00
fix #1115: add a special-cased error message
This commit is contained in:
@@ -80,6 +80,44 @@
|
||||
}),
|
||||
)
|
||||
|
||||
// Test coverage for a special JSX error message
|
||||
tests.push(
|
||||
test(['example.jsx', '--outfile=node.js'], {
|
||||
'example.jsx': `let button = <Button content="some so-called \\"button text\\"" />`,
|
||||
}, {
|
||||
expectedStderr: ` > example.jsx:1:58: error: Unexpected backslash in JSX element
|
||||
1 │ let button = <Button content="some so-called \\"button text\\"" />
|
||||
╵ ^
|
||||
example.jsx:1:45: note: JSX attributes use XML-style escapes instead of JavaScript-style escapes
|
||||
1 │ let button = <Button content="some so-called \\"button text\\"" />
|
||||
│ ~~
|
||||
╵ "
|
||||
example.jsx:1:29: note: Consider using a JavaScript string inside {...} instead of a JSX attribute
|
||||
1 │ let button = <Button content="some so-called \\"button text\\"" />
|
||||
│ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
╵ {"some so-called \\"button text\\""}
|
||||
|
||||
`,
|
||||
}),
|
||||
test(['example.jsx', '--outfile=node.js'], {
|
||||
'example.jsx': `let button = <Button content='some so-called \\'button text\\'' />`,
|
||||
}, {
|
||||
expectedStderr: ` > example.jsx:1:58: error: Unexpected backslash in JSX element
|
||||
1 │ let button = <Button content='some so-called \\'button text\\'' />
|
||||
╵ ^
|
||||
example.jsx:1:45: note: JSX attributes use XML-style escapes instead of JavaScript-style escapes
|
||||
1 │ let button = <Button content='some so-called \\'button text\\'' />
|
||||
│ ~~
|
||||
╵ '
|
||||
example.jsx:1:29: note: Consider using a JavaScript string inside {...} instead of a JSX attribute
|
||||
1 │ let button = <Button content='some so-called \\'button text\\'' />
|
||||
│ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
╵ {'some so-called \\'button text\\''}
|
||||
|
||||
`,
|
||||
}),
|
||||
)
|
||||
|
||||
// Tests for symlinks
|
||||
//
|
||||
// Note: These are disabled on Windows because they fail when run with GitHub
|
||||
|
||||
Reference in New Issue
Block a user