From 70bd7637ee83e48be3de7cae6f6a08273262ab83 Mon Sep 17 00:00:00 2001 From: Lingfan Gao Date: Thu, 28 Sep 2023 14:08:06 +0000 Subject: [PATCH] chore: use TsconfigPathsPlugin in cypress test config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cypress test config previously did not use TsConfigPathsPlugin so it relied on code being built in CI. However there is an edge case encountered in #29313. Lage will run the cypress tests of depednencies which *_can depend on depedencies not in the package.json tree_* 💣💣 ``` - react-message-bar-preview - react-button - react-tabster - react-provider (not in package.json, but used in cypress test) ``` --- scripts/cypress/src/base.config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/cypress/src/base.config.ts b/scripts/cypress/src/base.config.ts index b38813a4c3de84..d3a646e0d07a5e 100644 --- a/scripts/cypress/src/base.config.ts +++ b/scripts/cypress/src/base.config.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { defineConfig } from 'cypress'; +import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin'; import type { Configuration } from 'webpack'; /** @@ -32,6 +33,14 @@ const cypressWebpackConfig = (): Configuration => { }); } + baseWebpackConfig.resolve ??= {}; + baseWebpackConfig.resolve.plugins ??= []; + baseWebpackConfig.resolve.plugins.push( + new TsconfigPathsPlugin({ + configFile: path.resolve(__dirname, '../../../tsconfig.base.json'), + }), + ); + return baseWebpackConfig; };