Whenever I uncomment the lines on author.js
I get the following error:
/Users/xicombd/Code/taskq/taskq-api/node_modules/graphql/jsutils/invariant.js:20
throw new Error(message);
^
Error: Can only create List of a GraphQLType but got: undefined.
at invariant (/Users/xicombd/Code/taskq/taskq-api/node_modules/graphql/jsutils/invariant.js:20:11)
at new GraphQLList (/Users/xicombd/Code/taskq/taskq-api/node_modules/graphql/type/definition.js:712:39)
at Object.<anonymous> (/Users/xicombd/Code/taskq/taskq-api/lib/schema/types/author.js:21:13)
at Module._compile (module.js:435:26)
at normalLoader (/Users/xicombd/Code/taskq/taskq-api/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/xicombd/Code/taskq/taskq-api/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/xicombd/Code/taskq/taskq-api/lib/schema/types/post.js:6:17)
at Module._compile (module.js:435:26)
at normalLoader (/Users/xicombd/Code/taskq/taskq-api/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/xicombd/Code/taskq/taskq-api/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
Any ideas on how to deal with this?
Using a function to return the fields on author.js
does the trick:
On author.js
@@ -13 +13 @@
- fields: {
+ fields: () => ({
Running into similar issue, but only when testing with jest. My graphql server runs just fine, but one of my tests fails with:
All of my fields values are functions so the solution must be different. I'm trying to figure out what jest is doing to things to make it blow up like this.