[regression] Don't validate file.comments in @babel/types (#11752)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
This commit is contained in:
parent
1dd94e813e
commit
5743ad3923
@ -280,7 +280,11 @@ defineType("File", {
|
||||
validate: assertNodeType("Program"),
|
||||
},
|
||||
comments: {
|
||||
validate: assertEach(assertNodeType("Comment")),
|
||||
validate: !process.env.BABEL_TYPES_8_BREAKING
|
||||
? Object.assign(() => {}, {
|
||||
each: { oneOfNodeTypes: ["CommentBlock", "CommentLine"] },
|
||||
})
|
||||
: assertEach(assertNodeType("CommentBlock", "CommentLine")),
|
||||
optional: true,
|
||||
},
|
||||
tokens: {
|
||||
|
||||
9
packages/babel-types/test/regressions.js
Normal file
9
packages/babel-types/test/regressions.js
Normal file
@ -0,0 +1,9 @@
|
||||
import * as t from "../lib";
|
||||
|
||||
describe("regressions", () => {
|
||||
it("jest .toMatchInlineSnapshot used 'Line' for comments", () => {
|
||||
expect(() => {
|
||||
t.file(t.program([]), [{ type: "Line" }]);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user