From 695115e9a7cd7623fa882320fd8f454a6dd2e6f1 Mon Sep 17 00:00:00 2001 From: Zachary Williams Date: Wed, 8 Jun 2022 15:17:34 -0500 Subject: [PATCH] chore: prep npm packages for use with Cypress v10 BREAKING CHANGE: new version of packages for Cypress v10 --- npm/create-cypress-tests/package.json | 1 - npm/mount-utils/package.json | 1 - npm/react/package.json | 4 +- npm/vite-dev-server/cypress/e2e/react.cy.ts | 1 - .../cypress/e2e/vite-dev-server.cy.ts | 12 +- npm/vite-dev-server/package.json | 1 - npm/vue/package.json | 1 - npm/vue2/package.json | 1 - npm/webpack-dev-server/CHANGELOG.md | 188 ++++++++++++++++++ .../cypress/e2e/create-react-app.cy.ts | 1 - npm/webpack-dev-server/cypress/e2e/next.cy.ts | 1 - npm/webpack-dev-server/cypress/e2e/nuxt.cy.ts | 1 - .../cypress/e2e/react.cy.ts | 1 - .../cypress/e2e/vue-cli.cy.ts | 1 - .../cypress/e2e/webpack-dev-server.cy.ts | 13 ++ npm/webpack-dev-server/package.json | 1 - .../src/helpers/nextHandler.ts | 2 +- .../helpers/sourceRelativeWebpackModules.ts | 10 +- 18 files changed, 220 insertions(+), 21 deletions(-) diff --git a/npm/create-cypress-tests/package.json b/npm/create-cypress-tests/package.json index cd11e3d78fe5..6447e62beafe 100644 --- a/npm/create-cypress-tests/package.json +++ b/npm/create-cypress-tests/package.json @@ -2,7 +2,6 @@ "name": "create-cypress-tests", "version": "0.0.0-development", "description": "Cypress smart installation wizard", - "private": true, "main": "dist/src/main.js", "scripts": { "build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn prepare-copy-templates", diff --git a/npm/mount-utils/package.json b/npm/mount-utils/package.json index 8e6d3f519dac..5dc38055b8ba 100644 --- a/npm/mount-utils/package.json +++ b/npm/mount-utils/package.json @@ -2,7 +2,6 @@ "name": "@cypress/mount-utils", "version": "0.0.0-development", "description": "Shared utilities for the various component testing adapters", - "private": true, "main": "dist/index.js", "scripts": { "build": "tsc || echo 'built, with type errors'", diff --git a/npm/react/package.json b/npm/react/package.json index ff7d96f267a2..7928e4d73b58 100644 --- a/npm/react/package.json +++ b/npm/react/package.json @@ -2,7 +2,6 @@ "name": "@cypress/react", "version": "0.0.0-development", "description": "Test React components using Cypress", - "private": true, "main": "dist/cypress-react.cjs.js", "scripts": { "build": "rimraf dist && rollup -c rollup.config.js", @@ -44,8 +43,7 @@ "react-dom": "^=16.x || ^=17.x" }, "files": [ - "dist", - "support" + "dist" ], "types": "dist/index.d.ts", "license": "MIT", diff --git a/npm/vite-dev-server/cypress/e2e/react.cy.ts b/npm/vite-dev-server/cypress/e2e/react.cy.ts index 0f0e0ea5c33f..b753b4b9106d 100644 --- a/npm/vite-dev-server/cypress/e2e/react.cy.ts +++ b/npm/vite-dev-server/cypress/e2e/react.cy.ts @@ -1,4 +1,3 @@ -/// /// import type { fixtureDirs } from '@tooling/system-tests' import dedent from 'dedent' diff --git a/npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts b/npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts index 12d59f6da467..4a8b17fec406 100644 --- a/npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts +++ b/npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts @@ -1,4 +1,3 @@ -/// /// describe('Config options', () => { @@ -48,4 +47,15 @@ describe('Config options', () => { cy.contains(specWithWhitespace).click() cy.get('.passed > .num').should('contain', 1) }) + + it('supports @cypress/vite-dev-server', () => { + cy.scaffoldProject('vite2.9.1-react') + cy.openProject('vite2.9.1-react', ['--config-file', 'cypress-vite-dev-server-function.config.ts']) + cy.startAppServer('component') + + cy.visitApp() + cy.contains('App.cy.jsx').click() + cy.waitForSpecToFinish() + cy.get('.passed > .num').should('contain', 1) + }) }) diff --git a/npm/vite-dev-server/package.json b/npm/vite-dev-server/package.json index a4c49e89c94a..88091bd1ec96 100644 --- a/npm/vite-dev-server/package.json +++ b/npm/vite-dev-server/package.json @@ -2,7 +2,6 @@ "name": "@cypress/vite-dev-server", "version": "0.0.0-development", "description": "Launches Vite Dev Server for Component Testing", - "private": true, "main": "index.js", "scripts": { "build": "tsc || echo 'built, with type errors'", diff --git a/npm/vue/package.json b/npm/vue/package.json index cd3b0f270da3..de476f30ac71 100644 --- a/npm/vue/package.json +++ b/npm/vue/package.json @@ -2,7 +2,6 @@ "name": "@cypress/vue", "version": "0.0.0-development", "description": "Browser-based Component Testing for Vue.js with Cypress.io ✌️🌲", - "private": true, "main": "dist/cypress-vue.cjs.js", "scripts": { "build-prod": "yarn build", diff --git a/npm/vue2/package.json b/npm/vue2/package.json index 02f6b5fa97ad..7fbe9e6e7227 100644 --- a/npm/vue2/package.json +++ b/npm/vue2/package.json @@ -2,7 +2,6 @@ "name": "@cypress/vue2", "version": "0.0.0-development", "description": "Browser-based Component Testing for Vue.js@2 with Cypress.io ✌️🌲", - "private": true, "main": "dist/cypress-vue2.cjs.js", "scripts": { "typecheck": "tsc --noEmit", diff --git a/npm/webpack-dev-server/CHANGELOG.md b/npm/webpack-dev-server/CHANGELOG.md index e69de29bb2d1..832a5ccccd03 100644 --- a/npm/webpack-dev-server/CHANGELOG.md +++ b/npm/webpack-dev-server/CHANGELOG.md @@ -0,0 +1,188 @@ +# [@cypress/webpack-dev-server-v1.8.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.3...@cypress/webpack-dev-server-v1.8.4) (2022-03-29) + + +### Bug Fixes + +* **deps:** add 'lodash' to webpack-dev-server plugin dependencies ([#20815](https://github.com/cypress-io/cypress/issues/20815)) ([a472427](https://github.com/cypress-io/cypress/commit/a4724271601aff110c68ae4364e68764f22cd12c)) + +# [@cypress/webpack-dev-server-v1.8.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.2...@cypress/webpack-dev-server-v1.8.3) (2022-03-15) + + +### Bug Fixes + +* **webpack-dev-server:** do not encodeUri in loader ([#20575](https://github.com/cypress-io/cypress/issues/20575)) ([1b152fc](https://github.com/cypress-io/cypress/commit/1b152fca1b9ed9894cf7a5b2a964c856f73fc685)), closes [#20593](https://github.com/cypress-io/cypress/issues/20593) + +# [@cypress/webpack-dev-server-v1.8.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.1...@cypress/webpack-dev-server-v1.8.2) (2022-03-03) + + +### Bug Fixes + +* avoid nextjs unsafeCache and watchOptions ([#20440](https://github.com/cypress-io/cypress/issues/20440)) ([9f60901](https://github.com/cypress-io/cypress/commit/9f6090170b0675d25b26b98cd0f987a5e395ab78)) +* error regression - strip ansi colors out of cy.fixture() error message ([#20335](https://github.com/cypress-io/cypress/issues/20335)) ([e0bd6ac](https://github.com/cypress-io/cypress/commit/e0bd6ac2aaf8d00b9233fffefed8f6ed2484bf45)) + +# [@cypress/webpack-dev-server-v1.8.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.0...@cypress/webpack-dev-server-v1.8.1) (2022-02-08) + + +### Bug Fixes + +* detect newly added specs in dev-server compilation ([#17950](https://github.com/cypress-io/cypress/issues/17950)) ([f9ce67c](https://github.com/cypress-io/cypress/commit/f9ce67cfb6fed74a3549e7aff7ce0a5b217d9a13)) + +# [@cypress/webpack-dev-server-v1.8.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.7.0...@cypress/webpack-dev-server-v1.8.0) (2021-12-16) + + +### Features + +* use hoisted yarn install in binary build ([#17285](https://github.com/cypress-io/cypress/issues/17285)) ([e4f5b10](https://github.com/cypress-io/cypress/commit/e4f5b106d49d6ac0857c5fdac886f83b99558c88)) + +# [@cypress/webpack-dev-server-v1.7.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.6.0...@cypress/webpack-dev-server-v1.7.0) (2021-10-15) + + +### Features + +* normalized signatures webpack & vite servers ([#18379](https://github.com/cypress-io/cypress/issues/18379)) ([8f5308f](https://github.com/cypress-io/cypress/commit/8f5308f7068b80fb877da539ce34fb67ba497c4f)) + +# [@cypress/webpack-dev-server-v1.6.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.5.0...@cypress/webpack-dev-server-v1.6.0) (2021-09-10) + + +### Features + +* allow usage of @react/plugins with cypress.config.js ([#17738](https://github.com/cypress-io/cypress/issues/17738)) ([da4b1e0](https://github.com/cypress-io/cypress/commit/da4b1e06ce33945aabddda0e6e175dc0e1b488a5)) + +# [@cypress/webpack-dev-server-v1.5.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.4.0...@cypress/webpack-dev-server-v1.5.0) (2021-08-30) + + +### Features + +* support webpack-dev-server v4 ([#17918](https://github.com/cypress-io/cypress/issues/17918)) ([16e4759](https://github.com/cypress-io/cypress/commit/16e4759e0196f68c5f0525efb020211337748f94)) + +# [@cypress/webpack-dev-server-v1.4.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.1...@cypress/webpack-dev-server-v1.4.0) (2021-06-17) + + +### Features + +* **npm/webpack-dev-server,runner-ct:** Normalize webpack errors + general React/TS improvements ([#16613](https://github.com/cypress-io/cypress/issues/16613)) ([c0fc23a](https://github.com/cypress-io/cypress/commit/c0fc23a052e53354a8300dd3f783cb161ae161e1)) + +# [@cypress/webpack-dev-server-v1.3.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.0...@cypress/webpack-dev-server-v1.3.1) (2021-05-26) + + +### Bug Fixes + +* encodeURI to correctly load specs with white space ([#16416](https://github.com/cypress-io/cypress/issues/16416)) ([116fe64](https://github.com/cypress-io/cypress/commit/116fe649d74e54da9dd84bf126f08f4b9162c5d3)) +* Properly typecheck webpack-dev-server and fix several undefined issues ([#16503](https://github.com/cypress-io/cypress/issues/16503)) ([4bb1ecd](https://github.com/cypress-io/cypress/commit/4bb1ecd077fc3724e6c127982f98e1e6b0f1bb98)) + +# [@cypress/webpack-dev-server-v1.3.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.2.0...@cypress/webpack-dev-server-v1.3.0) (2021-05-13) + + +### Features + +* support webpack dev server v4 ([#16414](https://github.com/cypress-io/cypress/issues/16414)) ([0cea625](https://github.com/cypress-io/cypress/commit/0cea625f359ef554e87600ef7e7c3afa4e36da4d)) + +# [@cypress/webpack-dev-server-v1.2.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.6...@cypress/webpack-dev-server-v1.2.0) (2021-05-11) + + +### Features + +* exclude html pwa plugin in webpack dev server ([#16388](https://github.com/cypress-io/cypress/issues/16388)) ([14c2292](https://github.com/cypress-io/cypress/commit/14c22929badfe56385260a49336cf29e10902470)) + +# [@cypress/webpack-dev-server-v1.1.6](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.5...@cypress/webpack-dev-server-v1.1.6) (2021-04-30) + + +### Bug Fixes + +* update docs ([#16266](https://github.com/cypress-io/cypress/issues/16266)) ([72e064b](https://github.com/cypress-io/cypress/commit/72e064bd0705ae39830a2be2052534699862551a)) + +# [@cypress/webpack-dev-server-v1.1.5](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.4...@cypress/webpack-dev-server-v1.1.5) (2021-04-26) + + +### Bug Fixes + +* **component-testing:** correct imports for relative paths in cypress.json ([#16056](https://github.com/cypress-io/cypress/issues/16056)) ([10b89f8](https://github.com/cypress-io/cypress/commit/10b89f8d587d331256549c3ab7662f119df7a0f1)) +* **webpack-dev-server:** remove hard dependency on html-webpack-plugin v4 ([#16108](https://github.com/cypress-io/cypress/issues/16108)) ([4cfe4b1](https://github.com/cypress-io/cypress/commit/4cfe4b1971c615d615c05ce35b9f7dd5ef8315fc)) +* remove lazy-compile-webpack-plugin, make html-webpack-plugin a dependency ([#15954](https://github.com/cypress-io/cypress/issues/15954)) ([19136b6](https://github.com/cypress-io/cypress/commit/19136b6a131cffc31899c754cccce64ce1b4fb87)) +* run-ct does not hang on windows anymore ([#16022](https://github.com/cypress-io/cypress/issues/16022)) ([6c12a6c](https://github.com/cypress-io/cypress/commit/6c12a6c7b706ee4f708a9d19c62f18cd0838a433)) + +# [@cypress/webpack-dev-server-v1.1.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.3...@cypress/webpack-dev-server-v1.1.4) (2021-04-21) + + +### Bug Fixes + +* **webpack:** allow load custom asset on windows ([#16099](https://github.com/cypress-io/cypress/issues/16099)) ([7340851](https://github.com/cypress-io/cypress/commit/7340851097c792ca0d8d3157c3d803dccdd905d2)), closes [#16097](https://github.com/cypress-io/cypress/issues/16097) + +# [@cypress/webpack-dev-server-v1.1.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.2...@cypress/webpack-dev-server-v1.1.3) (2021-04-13) + + +### Bug Fixes + +* ensure root el mounting exists, remove userland html webpack plugin ([#15870](https://github.com/cypress-io/cypress/issues/15870)) ([726120d](https://github.com/cypress-io/cypress/commit/726120da183cb6d89c83181761d21f09844a9fc2)) +* make component testing windows compatible ([#15889](https://github.com/cypress-io/cypress/issues/15889)) ([602c762](https://github.com/cypress-io/cypress/commit/602c762cfd707ae497273ac38206d7f9d8545439)) +* remove lazy-compile-webpack-plugin ([#15964](https://github.com/cypress-io/cypress/issues/15964)) ([dcf3b14](https://github.com/cypress-io/cypress/commit/dcf3b14f3668cba8e19cf4eecd80db0c726f4248)) +* **webpack-dev-server:** remove output.publicPath from webpack-dev-server ([#15839](https://github.com/cypress-io/cypress/issues/15839)) ([8e894a0](https://github.com/cypress-io/cypress/commit/8e894a0fdb899be8dd8993319c9297ea73c10321)) + + +### Reverts + +* Revert "fix: ensure root el mounting exists, remove userland html webpack plugin (#15870)" (#15949) ([1d271ea](https://github.com/cypress-io/cypress/commit/1d271ea209c9d5116d61ed9b147a75eda6a61210)), closes [#15870](https://github.com/cypress-io/cypress/issues/15870) [#15949](https://github.com/cypress-io/cypress/issues/15949) + +# [@cypress/webpack-dev-server-v1.1.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.1...@cypress/webpack-dev-server-v1.1.2) (2021-04-06) + + +### Bug Fixes + +* **component-testing:** Correctly specify @cypress/webpack-dev-server peerDependencies ([#15820](https://github.com/cypress-io/cypress/issues/15820)) ([519b29c](https://github.com/cypress-io/cypress/commit/519b29cb897af59b84dc2f35752f785985348f2d)) + +# [@cypress/webpack-dev-server-v1.1.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.0...@cypress/webpack-dev-server-v1.1.1) (2021-04-05) + + +### Bug Fixes + +* **@cypress/react:** Devtools unpredictable resets ([#15612](https://github.com/cypress-io/cypress/issues/15612)) ([b1f831a](https://github.com/cypress-io/cypress/commit/b1f831a86a8bcc6646067bc8a9e67871026ff575)), closes [#15634](https://github.com/cypress-io/cypress/issues/15634) +* **component-testing:** Fix webpack-dev-server deps validation crash ([#15708](https://github.com/cypress-io/cypress/issues/15708)) ([254eb47](https://github.com/cypress-io/cypress/commit/254eb47d91c75a9f56162e7493ab83e5be169935)) + +# [@cypress/webpack-dev-server-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.4...@cypress/webpack-dev-server-v1.1.0) (2021-03-15) + + +### Bug Fixes + +* **@cypress/react:** Correctly unmount react components ([#15250](https://github.com/cypress-io/cypress/issues/15250)) ([6b515c7](https://github.com/cypress-io/cypress/commit/6b515c777ca2fa599f21dc47d181fd28a7eb6db0)) + + +### Features + +* Use lazy compilation for webpack-dev-server by default ([#15158](https://github.com/cypress-io/cypress/issues/15158)) ([f237050](https://github.com/cypress-io/cypress/commit/f237050fdb49e4e59c07a70bb178d88d0e7387a8)) +* webpack stop early when error in run mode ([4ec655b](https://github.com/cypress-io/cypress/commit/4ec655b784ff5f961f1d7ce371c5953d9116c576)) + +# [@cypress/webpack-dev-server-v1.0.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.3...@cypress/webpack-dev-server-v1.0.4) (2021-03-10) + + +### Bug Fixes + +* trigger release of the packages ([#15405](https://github.com/cypress-io/cypress/issues/15405)) ([1ce5755](https://github.com/cypress-io/cypress/commit/1ce57554e260850472cf753de68858f47b3f7b3d)) + +# [@cypress/webpack-dev-server-v1.0.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.2...@cypress/webpack-dev-server-v1.0.3) (2021-02-18) + + +### Bug Fixes + +* missing index-template.html from package.json deps for webpack-dev-server ([#15151](https://github.com/cypress-io/cypress/issues/15151)) ([36b0440](https://github.com/cypress-io/cypress/commit/36b0440b663c6a0075d23d8d23ae14d47de297c8)) + +# [@cypress/webpack-dev-server-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.1...@cypress/webpack-dev-server-v1.0.2) (2021-02-18) + + +### Bug Fixes + +* add webpack-dev-server to peerDependencies, improve peerDependency error handling, fix index-template.html path ([#15149](https://github.com/cypress-io/cypress/issues/15149)) ([2863e33](https://github.com/cypress-io/cypress/commit/2863e338920362cbb1ecf20c2fab28fbd3a52c33)) + +# [@cypress/webpack-dev-server-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.0...@cypress/webpack-dev-server-v1.0.1) (2021-02-17) + + +### Bug Fixes + +* add a trivial change to trigger semantic release ([#15127](https://github.com/cypress-io/cypress/issues/15127)) ([fb7540e](https://github.com/cypress-io/cypress/commit/fb7540e99d56e0cff89aaf2fe76065b9815bdbec)) +* trigger semantic release ([#15128](https://github.com/cypress-io/cypress/issues/15128)) ([3a6f3b1](https://github.com/cypress-io/cypress/commit/3a6f3b1928277f7086062b1107f424e5a0247e00)) + +# @cypress/webpack-dev-server-v1.0.0 (2021-02-16) + + +### Features + +* component testing ([#14479](https://github.com/cypress-io/cypress/issues/14479)) ([af26fbe](https://github.com/cypress-io/cypress/commit/af26fbebe6bc609132013a0493a116cc78bb1bd4)) \ No newline at end of file diff --git a/npm/webpack-dev-server/cypress/e2e/create-react-app.cy.ts b/npm/webpack-dev-server/cypress/e2e/create-react-app.cy.ts index b20c2ec4cf04..9d895cf66ce2 100644 --- a/npm/webpack-dev-server/cypress/e2e/create-react-app.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/create-react-app.cy.ts @@ -1,4 +1,3 @@ -// /// import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' diff --git a/npm/webpack-dev-server/cypress/e2e/next.cy.ts b/npm/webpack-dev-server/cypress/e2e/next.cy.ts index 46f0712747d9..8d8d458f3d27 100644 --- a/npm/webpack-dev-server/cypress/e2e/next.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/next.cy.ts @@ -1,4 +1,3 @@ -// /// import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' diff --git a/npm/webpack-dev-server/cypress/e2e/nuxt.cy.ts b/npm/webpack-dev-server/cypress/e2e/nuxt.cy.ts index 379e70bc2795..10f77d4c9bec 100644 --- a/npm/webpack-dev-server/cypress/e2e/nuxt.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/nuxt.cy.ts @@ -1,4 +1,3 @@ -// /// import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' diff --git a/npm/webpack-dev-server/cypress/e2e/react.cy.ts b/npm/webpack-dev-server/cypress/e2e/react.cy.ts index 4eca06947717..93cb7e72e620 100644 --- a/npm/webpack-dev-server/cypress/e2e/react.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/react.cy.ts @@ -1,4 +1,3 @@ -/// /// import type { fixtureDirs } from '@tooling/system-tests' import dedent from 'dedent' diff --git a/npm/webpack-dev-server/cypress/e2e/vue-cli.cy.ts b/npm/webpack-dev-server/cypress/e2e/vue-cli.cy.ts index 57ada2da8fd0..56911182abbc 100644 --- a/npm/webpack-dev-server/cypress/e2e/vue-cli.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/vue-cli.cy.ts @@ -1,4 +1,3 @@ -// /// import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' diff --git a/npm/webpack-dev-server/cypress/e2e/webpack-dev-server.cy.ts b/npm/webpack-dev-server/cypress/e2e/webpack-dev-server.cy.ts index 3906f21c761d..792b44b35e37 100644 --- a/npm/webpack-dev-server/cypress/e2e/webpack-dev-server.cy.ts +++ b/npm/webpack-dev-server/cypress/e2e/webpack-dev-server.cy.ts @@ -1,3 +1,5 @@ +/// + describe('Config options', () => { it('supports supportFile = false', () => { cy.scaffoldProject('webpack5_wds4-react') @@ -9,4 +11,15 @@ describe('Config options', () => { cy.waitForSpecToFinish() cy.get('.passed > .num').should('contain', 1) }) + + it('supports @cypress/webpack-dev-server', () => { + cy.scaffoldProject('webpack5_wds4-react') + cy.openProject('webpack5_wds4-react', ['--config-file', 'cypress-webpack-dev-server-function.config.ts']) + cy.startAppServer('component') + + cy.visitApp() + cy.contains('App.cy.jsx').click() + cy.waitForSpecToFinish() + cy.get('.passed > .num').should('contain', 1) + }) }) diff --git a/npm/webpack-dev-server/package.json b/npm/webpack-dev-server/package.json index 39ae86ed5e09..a479de984fb7 100644 --- a/npm/webpack-dev-server/package.json +++ b/npm/webpack-dev-server/package.json @@ -2,7 +2,6 @@ "name": "@cypress/webpack-dev-server", "version": "0.0.0-development", "description": "Launches Webpack Dev Server for Component Testing", - "private": true, "main": "dist/index.js", "scripts": { "prebuild": "rimraf dist", diff --git a/npm/webpack-dev-server/src/helpers/nextHandler.ts b/npm/webpack-dev-server/src/helpers/nextHandler.ts index 5f73a7ae1b61..768bccb538fa 100644 --- a/npm/webpack-dev-server/src/helpers/nextHandler.ts +++ b/npm/webpack-dev-server/src/helpers/nextHandler.ts @@ -232,7 +232,7 @@ function sourceNextWebpack (devServerConfig: WebpackDevServerConfig, framework: // Next with webpack@4 doesn't ship certain dependencies that HtmlWebpackPlugin requires, so we patch the resolution through to our bundled version if ((request === 'webpack' || request.startsWith('webpack/')) && webpack.majorVersion === 4) { const resolvePath = require.resolve(request, { - paths: [cypressWebpackPath], + paths: [cypressWebpackPath(devServerConfig)], }) debug('NextWebpack: Module._load for webpack@4 - %s', resolvePath) diff --git a/npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts b/npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts index dcdbe0bd5015..af9fd5fe494d 100644 --- a/npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts +++ b/npm/webpack-dev-server/src/helpers/sourceRelativeWebpackModules.ts @@ -50,9 +50,11 @@ const originalModuleResolveFilename = (Module as ModuleClass)._resolveFilename // We ship webpack@4 as part of '@cypress/webpack-batteries-included-preprocessor'. The path to this module // serves as our fallback. -export const cypressWebpackPath = require.resolve('@cypress/webpack-batteries-included-preprocessor', { - paths: [__dirname], -}) +export const cypressWebpackPath = (config: WebpackDevServerConfig) => { + return require.resolve('@cypress/webpack-batteries-included-preprocessor', { + paths: [config.cypressConfig.cypressBinaryRoot], + }) +} // Source the users framework from the provided projectRoot. The framework, if available, will server // as the resolve base for webpack dependency resolution. @@ -113,7 +115,7 @@ export function sourceWebpack (config: WebpackDevServerConfig, framework: Source debug('Webpack: Falling back to bundled version') webpackJsonPath = require.resolve('webpack/package.json', { - paths: [cypressWebpackPath], + paths: [cypressWebpackPath(config)], }) }