Skip to content

Using generated mocks when Graphql files are embedded in main target #3504

@toddgower-hiatus

Description

@toddgower-hiatus

Question

I'm just getting started trying to use the generated test mocks capability with Apollo but have run into issues with linking. Our generated GQL files are embedded in our main target and we've set up a framework to hold the mocks. Our config looks like this:

"output" : {
    "testMocks" : {
      "absolute" : {
        "path":"./hiatusTests/GraphQLV1Mocks",
        "accessModifier": "public"
      }
    },
    "schemaTypes" : {
      "path" : "./hiatus/API/GraphQL",
      "moduleType" : {
        "embeddedInTarget" : {
          "name" : "hiatus",
          "accessModifier": "internal"
        }
      }
    },
    "operations" : {
      "inSchemaModule" : {
      }
    }
  }

We're running into issues with the mocks attempting to import our main (app) target hiatus.

Image

This issue would go away if we created a separate framework to store our generated GQL files. Is that the only way to get this working or is it possible to leave our generated code in our main target?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that have a question which should be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions