From eb1e24a20f6646bfc282b06638b6730198e342dc Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Thu, 7 May 2020 12:19:25 -0400 Subject: [PATCH] fix: add note about speed --- README.md | 20 ++++++++++++++++++- .../testing-lib-example/testing-lib-spec.js | 3 +++ cypress/plugins/index.js | 2 ++ cypress/support/index.js | 3 --- package-lock.json | 6 +++--- package.json | 2 +- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 97a7e8c4..b93ea512 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,8 @@ You can use any [Visual Testing plugin](https://on.cypress.io/plugins#visual-tes ## Common problems -### Node Sass +
+ Node Sass When using Node Sass styles, tell Cypress to use [the system NodeJS](https://on.cypress.io/configuration#Node-version) rather than its bundled version. In `cypress.json` set option: @@ -235,6 +236,23 @@ When using Node Sass styles, tell Cypress to use [the system NodeJS](https://on. } ``` +
+ +
+ Slow bundling + +When you bundle spec file, you are now bundling React, Read DOM and other libraries, which is might be slow. For now, you can disable inline source maps by adding to your Webpack config settings (if available) the following: + +```js +const webpackOptions = { + devtool: false, +} +``` + +Keep your eye on issue [#156](https://github.com/bahmutov/cypress-react-unit-test/issues/156) for more information. + +
+ ## Development See [docs/development.md](./docs/development.md) diff --git a/cypress/component/advanced/testing-lib-example/testing-lib-spec.js b/cypress/component/advanced/testing-lib-example/testing-lib-spec.js index 41e90a5b..7907c214 100644 --- a/cypress/component/advanced/testing-lib-example/testing-lib-spec.js +++ b/cypress/component/advanced/testing-lib-example/testing-lib-spec.js @@ -2,6 +2,9 @@ import React from 'react' import { mount } from 'cypress-react-unit-test' import Fetch from './fetch' +// https://testing-library.com/docs/cypress-testing-library/intro +import '@testing-library/cypress/add-commands' + it('loads and displays greeting (testing-lib)', () => { cy.server() cy.route('/greeting', { greeting: 'Hello there' }).as('greet') diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 1aa7011d..7f07e49b 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -10,6 +10,8 @@ const webpackOptions = { react: path.resolve('./node_modules/react'), }, }, + mode: 'development', + devtool: false, module: { rules: [ { diff --git a/cypress/support/index.js b/cypress/support/index.js index ccae8472..f15cf39c 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -17,7 +17,4 @@ // using "npm run transpile" import 'cypress-react-unit-test/hooks' // import '@percy/cypress' - -// https://testing-library.com/docs/cypress-testing-library/intro -import '@testing-library/cypress/add-commands' // import 'cypress-plugin-snapshots/commands' diff --git a/package-lock.json b/package-lock.json index 45928599..b8674865 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1498,9 +1498,9 @@ } }, "@cypress/webpack-preprocessor": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.1.2.tgz", - "integrity": "sha512-Id8OQ9sRlSHhh8xXYI10jN54Mr5MHCbkD3+mu0BTMGrVFGNcWfcMc5+aOhDPlgHJ7rHp1mmaEJtpx853Fpg7lg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.2.0.tgz", + "integrity": "sha512-uvo0FfKL+rIXrBGS6qPIaJRD8euK+t6YoZvrTuLPnStprzlgeGfSCnCDUEMJZqFk9LwBd1NtOop+J7qNuv74ng==", "requires": { "bluebird": "3.7.1", "debug": "4.1.1" diff --git a/package.json b/package.json index 82d9d9d3..a2e59a9d 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ }, "dependencies": { "@cypress/code-coverage": "3.7.0", - "@cypress/webpack-preprocessor": "5.1.2", + "@cypress/webpack-preprocessor": "5.2.0", "babel-plugin-istanbul": "6.0.0", "debug": "4.1.1", "find-webpack": "1.6.1",