kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 312 forks source link

TestingOperation.flush expected enum but receive type in `graphql:15` #2324

Open magik9907 opened 6 days ago

magik9907 commented 6 days ago

Describe the bug While running tests for the versions listed below, the tests are failing with the error: Cannot read properties of undefined (reading 'SUBSCRIPTION').

Fail location in:

Code fragment where it's failed:

if (
    definition.kind === Kind.OPERATION_DEFINITION &&
    definition.operation !== OperationTypeNode.SUBSCRIPTION // <-- PROBLEM
  ) {
    this.complete();
  }

Reference:

To Reproduce

Steps to reproduce the behavior: Run test with dependencie version shown below.

Expected behavior

Environment:

- apollo-angular@8.0.0
- graphql@15.8.0x

Additional context

PowerKiKi commented 5 days ago

PR are welcome to fix this new limitation. Though I am wondering if we shouldn't just drop support for the old graphql v15 ? :thinking:

Was there as specific reason for you to be on v15 ?

magik9907 commented 5 days ago

In my case, I didn't see any reason to stay on v15 in project (it looks like it wasn't needed to update it earlier in project). I tested application with graphql:16 and it's worked ok (won't sure for 100% - maybe there is some specific cases but I might not saw it) and I think to keep that version in project.

I think it's good idead to drop support for v15 because there are works on graphql v17.

I have one more doubt, I run test for this project and it failed (for graphql:v15) image

But in github actions it passed image

I might be wrong, but it might failed only on unit tests but I don't see running unit test with graphql:15 but only e2e. So, maybe it might good idea to run also additional unit tests for peer dependencies to check compatibility in PR for future changes.