Skip to content

Releases: tgriesser/cypress-graphql-mock

v0.3.1

20 Aug 05:45
Compare
Choose a tag to compare

This release adds the following changes:

Breaking changes

N/A

Features

  • Right now it's possible to add the delay before mocked response will be resolved. Simply add the delay prop
cy.mockGraphqlOps({
  operations: {
    delay: 1000, // 1 second
    userNameChange: new GraphQLError("Your message goes here")
  }
});
  • Also added an ability to throw graphql error. You need to
import { GraphQLError } from "graphql";

cy.mockGraphqlOps({
  delay: 1000, // wait 1 second
  operations: {
    userNameChange: new GraphQLError("Your message goes here")
  }
});

Make sure that this import statement must be properly preprocessed (e.g. https://github.com/cypress-io/cypress-webpack-preprocessor). Do not forget to include processing of .mjs files