fix: use BABEL_8_BREAKING for new babel-types breaking changes (#13538)

This commit is contained in:
Huáng Jùnliàng 2021-07-09 09:27:59 -04:00 committed by GitHub
parent 79d3276f61
commit 234316161f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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"),
},

View File

@ -7,7 +7,7 @@ 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(),
@ -15,7 +15,7 @@ describe("builders", function () {
// 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",
@ -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',
);