Skip to content

Commit

Permalink
fix(react): ensure playwright configuration is using correct port in …
Browse files Browse the repository at this point in the history
…app gen
  • Loading branch information
Coly010 committed Feb 22, 2024
1 parent 28cd744 commit 917ac8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/generators/application/lib/add-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function addE2e(
bundler: options.bundler === 'rspack' ? 'webpack' : options.bundler,
skipFormat: true,
devServerTarget: `${options.projectName}:serve`,
baseUrl: 'http://localhost:4200',
baseUrl: `http://localhost:${options.devServerPort ?? 4200}`,
jsx: true,
rootProject: options.rootProject,
webServerCommands: hasNxBuildPlugin
Expand Down Expand Up @@ -85,7 +85,7 @@ export async function addE2e(
webServerCommand: `${getPackageManagerCommand().exec} nx serve ${
options.name
}`,
webServerAddress: 'http://localhost:4200',
webServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
rootProject: options.rootProject,
addPlugin: options.addPlugin,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export function updateModuleFederationE2eProject(
) {
try {
let projectConfig = readProjectConfiguration(host, options.e2eProjectName);
projectConfig.targets.e2e.options = {
...projectConfig.targets.e2e.options,
baseUrl: `http://localhost:${options.devServerPort}`,
};
updateProjectConfiguration(host, options.e2eProjectName, projectConfig);
if (projectConfig.targets.e2e.executor !== '@nx/playwright:playwright') {
projectConfig.targets.e2e.options = {
...projectConfig.targets.e2e.options,
baseUrl: `http://localhost:${options.devServerPort}`,
};
updateProjectConfiguration(host, options.e2eProjectName, projectConfig);
}
} catch {
// nothing
}
Expand Down

0 comments on commit 917ac8e

Please sign in to comment.