Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Flow #2658

Merged
merged 1 commit into from Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions .flowconfig
Expand Up @@ -35,8 +35,6 @@ include_warnings=true
module.use_strict=true
babel_loose_array_spread=true
esproposal.optional_chaining=enable
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$DisableFlowOnNegativeTest

[version]
^0.126.0
^0.127.0
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -64,7 +64,7 @@
"eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules",
"eslint-plugin-istanbul": "0.1.1",
"eslint-plugin-node": "11.1.0",
"flow-bin": "0.126.1",
"flow-bin": "0.127.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"prettier": "2.0.5",
Expand Down
6 changes: 3 additions & 3 deletions src/error/__tests__/formatError-test.js
Expand Up @@ -8,7 +8,7 @@ import { GraphQLError } from '../GraphQLError';

describe('formatError: default error formatter', () => {
it('uses default message', () => {
// $DisableFlowOnNegativeTest
// $FlowExpectedError
const e = new GraphQLError();

expect(formatError(e)).to.deep.equal({
Expand Down Expand Up @@ -47,12 +47,12 @@ describe('formatError: default error formatter', () => {
});

it('rejects null and undefined errors', () => {
// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => formatError(undefined)).to.throw(
'Received null or undefined error.',
);

// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => formatError(null)).to.throw(
'Received null or undefined error.',
);
Expand Down
2 changes: 1 addition & 1 deletion src/execution/__tests__/abstract-test.js
Expand Up @@ -405,7 +405,7 @@ describe('Execute: Handles execution of abstract types', () => {
const fooInterface = new GraphQLInterfaceType({
name: 'FooInterface',
fields: { bar: { type: GraphQLString } },
// $DisableFlowOnNegativeTest
// $FlowExpectedError
resolveType() {
return [];
},
Expand Down
6 changes: 3 additions & 3 deletions src/execution/__tests__/executor-test.js
Expand Up @@ -32,14 +32,14 @@ describe('Execute: Handles basic execution tasks', () => {
}),
});

// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => execute({ schema })).to.throw('Must provide document.');
});

it('throws if no schema is provided', () => {
const document = parse('{ field }');

// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => execute({ document })).to.throw(
'Expected undefined to be a GraphQL schema.',
);
Expand All @@ -64,7 +64,7 @@ describe('Execute: Handles basic execution tasks', () => {
`);
const variableValues = '{ "a": 1 }';

// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => execute({ schema, document, variableValues })).to.throw(
'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.',
);
Expand Down
4 changes: 2 additions & 2 deletions src/language/__tests__/parser-test.js
Expand Up @@ -24,12 +24,12 @@ function expectSyntaxError(text) {

describe('Parser', () => {
it('asserts that a source to parse was provided', () => {
// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => parse()).to.throw('Must provide Source. Received: undefined.');
});

it('asserts that an invalid source to parse was provided', () => {
// $DisableFlowOnNegativeTest
// $FlowExpectedError
expect(() => parse({})).to.throw('Must provide Source. Received: {}.');
});

Expand Down
3 changes: 2 additions & 1 deletion src/language/__tests__/printer-test.js
Expand Up @@ -25,7 +25,8 @@ describe('Printer: Query document', () => {

it('produces helpful error messages', () => {
const badAST = { random: 'Data' };
// $DisableFlowOnNegativeTest

// $FlowExpectedError
expect(() => print(badAST)).to.throw(
'Invalid AST Node: { random: "Data" }.',
);
Expand Down
3 changes: 2 additions & 1 deletion src/language/__tests__/schema-printer-test.js
Expand Up @@ -21,7 +21,8 @@ describe('Printer: SDL document', () => {

it('produces helpful error messages', () => {
const badAST = { random: 'Data' };
// $DisableFlowOnNegativeTest

// $FlowExpectedError
expect(() => print(badAST)).to.throw(
'Invalid AST Node: { random: "Data" }.',
);
Expand Down
14 changes: 7 additions & 7 deletions src/subscription/__tests__/subscribe-test.js
Expand Up @@ -322,27 +322,27 @@ describe('Subscription Initialization Phase', () => {
`);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe(null, document),
// $FlowExpectedError
() => subscribe({ schema: null, document }),
'Expected null to be a GraphQL schema.',
);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
// $FlowExpectedError
() => subscribe({ document }),
'Expected undefined to be a GraphQL schema.',
);
});

it('throws an error if document is missing', async () => {
await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
() => subscribe(emailSchema, null),
// $FlowExpectedError
() => subscribe({ schema: emailSchema, document: null }),
'Must provide document.',
);

await expectPromiseToThrow(
// $DisableFlowOnNegativeTest
// $FlowExpectedError
() => subscribe({ schema: emailSchema }),
'Must provide document.',
);
Expand Down Expand Up @@ -372,7 +372,7 @@ describe('Subscription Initialization Phase', () => {
it('should pass through unexpected errors thrown in subscribe', async () => {
let expectedError;
try {
// $DisableFlowOnNegativeTest
// $FlowExpectedError
await subscribe({ schema: emailSchema, document: {} });
} catch (error) {
expectedError = error;
Expand Down