-
Notifications
You must be signed in to change notification settings - Fork 103
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
Always guard against undefined type in fieldAvailableOnType #231
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ const validatorCases = { | |
"const x = gql`fragment FilmFragment on Floof { title } { allFilms { films { ...FilmFragment } } }`", | ||
errors: [ | ||
{ | ||
message: 'Unknown type "Floof".', | ||
message: /Unknown type "Floof"/, | ||
type: "TaggedTemplateExpression" | ||
} | ||
] | ||
|
@@ -162,7 +162,7 @@ const validatorCases = { | |
errors: [ | ||
{ | ||
message: | ||
'Field "sum" argument "b" of type "Int!" is required but not provided.', | ||
/Field "sum" argument "b" of type "Int!" is required/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make these regexes so they pass in all versions of |
||
type: "TaggedTemplateExpression" | ||
} | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ const requiredFieldsTestCases = { | |
"const x = gql`query { greetings { id, hello, foo } }`", | ||
"const x = gql`query { greetings { id ... on Greetings { hello } } }`", | ||
"const x = gql`fragment Name on Greetings { id hello }`", | ||
"const x = gql`fragment Foo on FooBar { id, hello, foo }`", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case would throw an error if not for the fix in |
||
"const x = gql`fragment Id on Node { id ... on NodeA { fieldA } }`", | ||
"const x = gql`query { nodes { id ... on NodeA { fieldA } } }`", | ||
], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests have been failing in CI for a while, because in CI tests rung against all versions of
graphql
that satisfy the semver ranges defined in.tav.yml
:eslint-plugin-graphql/.tav.yml
Line 3 in ed2e619
Amongst those was
v14.3.1
, which shows a slightly different error message for theProvidedRequiredArguments
validator. You can see the error here: https://travis-ci.org/apollographql/eslint-plugin-graphql/jobs/548949602If you look at recent PRs, all of them are failing with the same error. What made this confusing to me was that
tav
was only being run on CI, and not locally. So locally tests were passing. For that reason, I thought it would be best iftav
also runs locally now –– hence why the--ci
flag is removed here. If that's not okay, I can revert this part of the PR.Anyways, the fix for the actual error can be seen below in
test/validationRules/built-in.js