lewisf / extract-gql

2 stars 1 forks source link

Provide support with files with template tags and interpolated fragments. #4

Closed lewisf closed 7 years ago

lewisf commented 7 years ago

I tried running this on a file with a template tag with interpolated fragments and it didn't work. If this is for a good reason, we can be a little bit more helpful with helping the user identify why. Let's add test cases for this and get this passing.

Example of a failing case:

graphql(gql`
  query SomeQuery {
    something() {
      myField
      myOtherField
    }
  }
  ${SomeFragment)
  ${SomeOtherFragment)
`)

Current error message:

(node:60535) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'selectionSet' of undefined
lewisf commented 7 years ago

Not sure why this didn't work before, but I added a test case with multiple interpolations in #8