-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser): uncaught mismatch between JSX opening/closing tags (#14528)
- Loading branch information
Showing
5 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { expect, test } from "bun:test"; | ||
import { bunEnv, bunExe } from "harness"; | ||
import { join } from "path"; | ||
import fs from "fs"; | ||
|
||
test("JSXElement with mismatched closing tags produces a syntax error", async () => { | ||
const files = await fs.promises.readdir(import.meta.dir); | ||
const fixtures = files.filter(file => !file.endsWith(".test.ts")).map(fixture => join(import.meta.dir, fixture)); | ||
|
||
const bakery = fixtures.map( | ||
fixture => | ||
Bun.spawn({ | ||
cmd: [bunExe(), fixture], | ||
cwd: import.meta.dir, | ||
stdio: ["inherit", "inherit", "inherit"], | ||
env: bunEnv, | ||
}).exited, | ||
); | ||
|
||
// all subprocesses should fail. | ||
const exited = await Promise.all(bakery); | ||
expect(exited).toEqual(Array.from({ length: fixtures.length }, () => 1)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(<div></p>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
console.log(<Foo></Bar>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// mismatch where openening tag is not a valid IdentifierName, but is a valid | ||
// JSXIdentifierName | ||
console.log(<div-:button></p>); |