Skip to content

Commit

Permalink
fix: use BABEL_8_BREAKING for new babel-types breaking changes (#13538)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 9, 2021
1 parent 79d3276 commit 2343161
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/babel-types/src/definitions/typescript.ts
Expand Up @@ -566,7 +566,7 @@ defineType("TSTypeParameter", {
visitor: ["constraint", "default"],
fields: {
name: {
validate: !process.env.BABEL_TYPES_8_BREAKING
validate: !process.env.BABEL_8_BREAKING
? assertValueType("string")
: assertNodeType("Identifier"),
},
Expand Down
Expand Up @@ -7,15 +7,15 @@ describe("builders", function () {
const tsTypeParameter = t.tsTypeParameter(
t.tsTypeReference(t.identifier("bar")),
t.tsTypeReference(t.identifier("baz")),
!process.env.BABEL_TYPES_8_BREAKING ? "foo" : t.identifier("foo"),
!process.env.BABEL_8_BREAKING ? "foo" : t.identifier("foo"),
);
expect(tsTypeParameter).toMatchSnapshot({
name: expect.anything(),
});
// TODO(babel-8): move this check to the snapshot
expect(tsTypeParameter).toEqual(
expect.objectContaining({
name: !process.env.BABEL_TYPES_8_BREAKING
name: !process.env.BABEL_8_BREAKING
? "foo"
: expect.objectContaining({
name: "foo",
Expand All @@ -31,7 +31,7 @@ describe("builders", function () {
t.tsTypeReference(t.identifier("baz")),
);
}).toThrow(
!process.env.BABEL_TYPES_8_BREAKING
!process.env.BABEL_8_BREAKING
? "Property name expected type of string but got null"
: 'Property name of TSTypeParameter expected node to be of a type ["Identifier"] but instead got undefined',
);
Expand Down

0 comments on commit 2343161

Please sign in to comment.