Skip to content

Commit

Permalink
chore: update cypress to v5 (#1688)
Browse files Browse the repository at this point in the history
* chore: update cypress to v5

* chore: remove unused cypress dependency/command

* chore: add missing dep

* fix: import

* chore(cypress): remove unnecessary option

* fix: use mock function from apollo-server
  • Loading branch information
emmenko authored Aug 21, 2020
1 parent 74d43d2 commit 5e603e1
Show file tree
Hide file tree
Showing 8 changed files with 631 additions and 93 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"baseUrl": "http://localhost:3001"
"baseUrl": "http://localhost:3001",
"retries": 1
}
2 changes: 0 additions & 2 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/* eslint-disable global-require */
const percyHealthCheck = require('@percy/cypress/task');
const getGraphqlSchema = require('../../graphql-test-utils/cypress/task');

// plugins file
module.exports = (on, cypressConfig) => {
Expand All @@ -35,7 +34,6 @@ module.exports = (on, cypressConfig) => {

on('task', {
...percyHealthCheck,
...getGraphqlSchema,
});

return Object.assign({}, cypressConfig, {
Expand Down
1 change: 0 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '@percy/cypress';
import '@testing-library/cypress/add-commands';
import '../../graphql-test-utils/cypress/add-commands';

function isLocalhost() {
const url = new URL(Cypress.config('baseUrl'));
Expand Down
7 changes: 2 additions & 5 deletions graphql-test-utils/create-graphql-mock-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { graphql, buildClientSchema } from 'graphql';
import { addMockFunctionsToSchema } from 'graphql-tools';
import { addMockFunctionsToSchema } from 'apollo-server';
import { formatApolloErrors } from 'apollo-server-errors';
import resolveAndCacheSchema from './resolve-and-cache-schema';

Expand Down Expand Up @@ -27,10 +27,7 @@ const createGraphqlMockServer = (
const schema = buildClientSchema(resolveAndCacheSchema(targetName));
const mocks = mocksByTarget[targetName] || {};
const operations = operationsByTarget[targetName] || {};
addMockFunctionsToSchema({
schema,
mocks,
});
addMockFunctionsToSchema({ schema, mocks });
const { query, variables, operationName } = JSON.parse(req.body());
const rootValue = getRootValue(operations, operationName, variables);
let response;
Expand Down
13 changes: 0 additions & 13 deletions graphql-test-utils/cypress/add-commands.js

This file was deleted.

8 changes: 0 additions & 8 deletions graphql-test-utils/cypress/task.js

This file was deleted.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@
"@types/webpack-env": "1.15.2",
"@typescript-eslint/eslint-plugin": "3.9.0",
"@typescript-eslint/parser": "3.9.0",
"apollo-server": "2.16.1",
"apollo-server-errors": "2.4.2",
"babel-eslint": "10.1.0",
"babel-plugin-import-graphql": "2.7.0",
"babel-plugin-transform-rename-import": "2.3.0",
"babel-plugin-typescript-to-proptypes": "1.4.0",
"bulk-update-versions": "1.1.0",
"cross-env": "7.0.2",
"cypress": "4.12.1",
"cypress-graphql-mock": "0.3.1",
"cypress": "5.0.0",
"dotenv": "8.2.0",
"enzyme": "3.11.0",
"eslint": "7.6.0",
Expand All @@ -135,6 +135,7 @@
"gatsby-plugin-emotion": "4.3.10",
"gatsby-plugin-mdx": "1.2.34",
"graphql-cli": "3.0.14",
"graphql-tools": "6.0.18",
"husky": "4.2.5",
"jest": "26.4.0",
"jest-each": "26.4.0",
Expand Down Expand Up @@ -182,7 +183,7 @@
"@types/react": "16.9.46",
"@types/react-router": "5.1.8",
"**/sharp": "0.25.4",
"cypress": "4.12.1",
"cypress": "5.0.0",
"pretty-format": "26.4.0"
},
"engines": {
Expand Down
Loading

1 comment on commit 5e603e1

@vercel
Copy link

@vercel vercel bot commented on 5e603e1 Aug 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.