Skip to content

Commit 6c2311f

Browse files
authored
build: allow to override appHtml & appPublic paths for e2e test (#48)
1 parent 2b12afe commit 6c2311f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/react-scripts/config/paths.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const distPath = process.env.DIST_PATH || 'dist';
3434
const isBuildingBundle =
3535
process.env.BUILD_ESM_BUNDLE === 'true' ||
3636
process.env.BUILD_UMD_BUNDLE === 'true';
37+
const isRunningE2ETests = process.env.E2E_TESTS === 'true';
3738

3839
const moduleFileExtensions = [
3940
'web.mjs',
@@ -68,8 +69,10 @@ module.exports = {
6869
appPath: resolveApp('.'),
6970
appBuild: resolveApp(buildPath),
7071
appDist: resolveApp(distPath),
71-
appPublic: resolveApp('public'),
72-
appHtml: resolveApp('public/index.html'),
72+
appPublic: resolveApp(isRunningE2ETests ? 'test/cypress/static' : 'public'),
73+
appHtml: resolveApp(
74+
isRunningE2ETests ? 'test/cypress/static/index.html' : 'public/index.html'
75+
),
7376
appIndexJs: resolveModule(
7477
resolveApp,
7578
isBuildingBundle ? 'src/App' : 'src/index'
@@ -97,8 +100,10 @@ module.exports = {
97100
appPath: resolveApp('.'),
98101
appBuild: resolveApp(buildPath),
99102
appDist: resolveApp(distPath),
100-
appPublic: resolveApp('public'),
101-
appHtml: resolveApp('public/index.html'),
103+
appPublic: resolveApp(isRunningE2ETests ? 'test/cypress/static' : 'public'),
104+
appHtml: resolveApp(
105+
isRunningE2ETests ? 'test/cypress/static/index.html' : 'public/index.html'
106+
),
102107
appIndexJs: resolveModule(
103108
resolveApp,
104109
isBuildingBundle ? 'src/App' : 'src/index'

0 commit comments

Comments
 (0)