From acdd8332bd387764f011333de19519ae1e057e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Thu, 26 Aug 2021 17:36:20 +0200 Subject: [PATCH] fix test setup --- package.json | 2 +- tests/cypress/plugins/index.js | 41 +++++++++++++++++++++++++++------- yarn.lock | 22 ++++++++---------- 3 files changed, 43 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 757d1690e..027b900af 100644 --- a/package.json +++ b/package.json @@ -33,7 +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", + "@cypress/webpack-preprocessor": "^5.9.1", "@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 f13710eec..653d4e482 100644 --- a/tests/cypress/plugins/index.js +++ b/tests/cypress/plugins/index.js @@ -12,15 +12,40 @@ // the project's config changing) const path = require('path') -const { startDevServer } = require('@cypress/vite-dev-server') +const globby = require('globby') +const webpackPreprocessor = require('@cypress/webpack-preprocessor') module.exports = on => { - on('dev-server:start', options => { - return startDevServer({ - options, - viteConfig: { - configFile: path.resolve(__dirname, '../../demos/vite.config.js'), - }, + const alias = {} + + globby.sync('../packages/*', { onlyDirectories: true }) + .map(name => name.replace('../packages/', '')) + .forEach(name => { + alias[`@tiptap/${name}$`] = path.resolve(`../packages/${name}/src/index.ts`) }) - }) + + const options = { + webpackOptions: { + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /\.jsx?$/, + use: 'babel-loader', + exclude: /node_modules/, + }, + ], + }, + resolve: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + alias, + }, + }, + } + + on('file:preprocessor', webpackPreprocessor(options)) } diff --git a/yarn.lock b/yarn.lock index 839671ea6..a0dcfe52f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1003,13 +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== +"@cypress/webpack-preprocessor@^5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.9.1.tgz#2694aa832baf3984d90bcb899e1ecff377560904" + integrity sha512-cg1ikftIo7NdlRA8ocNSxWjHJlh1JlTkN9ZfXUuKWWcJgrEdYLjXk0UzY6gYbLLaFka4oIhN6SvL5Y/7iELvgg== dependencies: - debug "^4.3.2" - get-port "^5.1.1" + bluebird "^3.7.1" + debug "4.3.2" + lodash "^4.17.20" "@cypress/xvfb@^1.2.4": version "1.2.4" @@ -3739,7 +3740,7 @@ blob-util@^2.0.2: resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb" integrity sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ== -bluebird@^3.1.1, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5, bluebird@^3.7.2: +bluebird@^3.1.1, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5, bluebird@^3.7.1, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -5545,7 +5546,7 @@ debug@3.1.0, debug@~3.1.0: dependencies: ms "2.0.0" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: +debug@4, debug@4.3.2, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== @@ -7257,11 +7258,6 @@ 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"