diff --git a/.babelrc.json b/.babelrc.json index e7e59a32a2..d6bcc04649 100644 --- a/.babelrc.json +++ b/.babelrc.json @@ -1,4 +1,9 @@ { "plugins": ["@babel/plugin-transform-flow-strip-types"], - "presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] + "presets": [ + [ + "@babel/preset-env", + { "bugfixes": true, "targets": { "node": "current" } } + ] + ] } diff --git a/src/type/validate.js b/src/type/validate.js index 9de721adae..919e58248d 100644 --- a/src/type/validate.js +++ b/src/type/validate.js @@ -183,11 +183,7 @@ function validateDirectives(context: SchemaValidationContext): void { if (isRequiredArgument(arg) && arg.deprecationReason != null) { context.reportError( `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - // istanbul ignore next (TODO need to write coverage tests) - arg.astNode?.type, - ], + [getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type], ); } } @@ -299,11 +295,7 @@ function validateFields( if (isRequiredArgument(arg) && arg.deprecationReason != null) { context.reportError( `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, - [ - getDeprecatedDirectiveNode(arg.astNode), - // istanbul ignore next (TODO need to write coverage tests) - arg.astNode?.type, - ], + [getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type], ); } } @@ -376,12 +368,7 @@ function validateTypeImplementsInterface( `Interface field ${iface.name}.${fieldName} expects type ` + `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + `is type ${inspect(typeField.type)}.`, - [ - // istanbul ignore next (TODO need to write coverage tests) - ifaceField.astNode?.type, - // istanbul ignore next (TODO need to write coverage tests) - typeField.astNode?.type, - ], + [ifaceField.astNode?.type, typeField.astNode?.type], ); } diff --git a/src/utilities/__tests__/buildASTSchema-test.js b/src/utilities/__tests__/buildASTSchema-test.js index 4e3ca524d6..828ffa1abf 100644 --- a/src/utilities/__tests__/buildASTSchema-test.js +++ b/src/utilities/__tests__/buildASTSchema-test.js @@ -51,7 +51,6 @@ function cycleSDL(sdl: string): string { } function expectASTNode(obj: ?{ +astNode: ?ASTNode, ... }) { - // istanbul ignore next (FIXME) invariant(obj?.astNode != null); return expect(print(obj.astNode)); } diff --git a/src/utilities/__tests__/extendSchema-test.js b/src/utilities/__tests__/extendSchema-test.js index cd26bcaf7d..67703c07e2 100644 --- a/src/utilities/__tests__/extendSchema-test.js +++ b/src/utilities/__tests__/extendSchema-test.js @@ -43,7 +43,6 @@ function expectExtensionASTNodes(obj: { } function expectASTNode(obj: ?{ +astNode: ?ASTNode, ... }) { - // istanbul ignore next (FIXME) invariant(obj?.astNode != null); return expect(print(obj.astNode)); } diff --git a/src/utilities/__tests__/getOperationRootType-test.js b/src/utilities/__tests__/getOperationRootType-test.js index 627b0efb86..d96864fea6 100644 --- a/src/utilities/__tests__/getOperationRootType-test.js +++ b/src/utilities/__tests__/getOperationRootType-test.js @@ -36,7 +36,7 @@ const subscriptionType = new GraphQLObjectType({ function getOperationNode(doc: DocumentNode) { const operationNode = doc.definitions[0]; - invariant(operationNode && operationNode.kind === Kind.OPERATION_DEFINITION); + invariant(operationNode.kind === Kind.OPERATION_DEFINITION); return operationNode; } @@ -76,7 +76,7 @@ describe('getOperationRootType', () => { `); const schemaNode = doc.definitions[0]; - invariant(schemaNode && schemaNode.kind === Kind.SCHEMA_DEFINITION); + invariant(schemaNode.kind === Kind.SCHEMA_DEFINITION); const [ queryNode, mutationNode,