From 1322f12028aa2c23f0e17be8a6cce1e1506bdf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Thu, 26 Aug 2021 16:49:08 +0200 Subject: [PATCH] add @cypress/vite-dev-server --- package.json | 1 + tests/cypress/plugins/index.js | 16 ++++++++++++---- yarn.lock | 13 +++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a021b31d..757d1690 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@babel/plugin-proposal-optional-chaining": "^7.14.5", "@babel/preset-env": "^7.15.0", "@babel/preset-react": "^7.14.5", + "@cypress/vite-dev-server": "^2.0.7", "@lerna/batch-packages": "^3.16.0", "@lerna/filter-packages": "^3.18.0", "@lerna/project": "^3.21.0", diff --git a/tests/cypress/plugins/index.js b/tests/cypress/plugins/index.js index 94620a2c..f13710ee 100644 --- a/tests/cypress/plugins/index.js +++ b/tests/cypress/plugins/index.js @@ -11,8 +11,16 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) -// eslint-disable-next-line -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config +const path = require('path') +const { startDevServer } = require('@cypress/vite-dev-server') + +module.exports = on => { + on('dev-server:start', options => { + return startDevServer({ + options, + viteConfig: { + configFile: path.resolve(__dirname, '../../demos/vite.config.js'), + }, + }) + }) } diff --git a/yarn.lock b/yarn.lock index ecd7e102..839671ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1003,6 +1003,14 @@ tunnel-agent "^0.6.0" uuid "^8.3.2" +"@cypress/vite-dev-server@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@cypress/vite-dev-server/-/vite-dev-server-2.0.7.tgz#1255b783d95cc71f1c3e0df1f9917832e0bd016f" + integrity sha512-0RAYG/WvgB2lAiu+voqMtGy2PdbwVz8EB6q1+u2G8akHepbe8KSrObdO7EHCZXzMQ0VQlmToonO4Qx+OUwPPwg== + dependencies: + debug "^4.3.2" + get-port "^5.1.1" + "@cypress/xvfb@^1.2.4": version "1.2.4" resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a" @@ -7249,6 +7257,11 @@ get-port@^4.2.0: resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== +get-port@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-5.1.1.tgz#0469ed07563479de6efb986baf053dcd7d4e3193" + integrity sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ== + get-proxy@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/get-proxy/-/get-proxy-2.1.0.tgz#349f2b4d91d44c4d4d4e9cba2ad90143fac5ef93"