graphql-coverage icon indicating copy to clipboard operation
graphql-coverage copied to clipboard

Support for testing multiple graphql schemas

Open jgrau opened this issue 1 year ago • 1 comments

Hi @pocke

I just found this gem and thinks it's very interesting. My application has two graphql schemas: one for our public api and one for our admin-only application. I tried

GraphQL::Coverage.enable(PublicSchema)
GraphQL::Coverage.enable(AdminSchema)

but that fails with

An error occurred in a `before(:suite)` hook.
Failure/Error: GraphQL::Coverage.enable(AdminSchema)

GraphQL::Coverage::Errors::SchemaMismatch:
  Schema mismatch: expected PublicSchema, got AdminSchema
# ./spec/rails_helper.rb:149:in `block (2 levels) in <top (required)>'


Finished in 0.01807 seconds (files took 5.52 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

(the line reference in the error above is GraphQL::Coverage.enable(AdminSchema)

Would it be possible to support testing multiple schemas? Can you see any workarounds?

jgrau avatar Dec 16 '23 19:12 jgrau