From 3e86e42537f14b48617fde7ec38e130ba2da4ad5 Mon Sep 17 00:00:00 2001 From: Caleb Ukle Date: Wed, 19 Jul 2023 13:37:00 -0500 Subject: [PATCH] fix(testing): run playwright from workspaceRoot (#18195) --- packages/playwright/src/executors/playwright/playwright.ts | 2 +- .../src/generators/configuration/configuration.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/playwright/src/executors/playwright/playwright.ts b/packages/playwright/src/executors/playwright/playwright.ts index b7ea1d5e20e97..8d74e8fa84d21 100644 --- a/packages/playwright/src/executors/playwright/playwright.ts +++ b/packages/playwright/src/executors/playwright/playwright.ts @@ -64,7 +64,7 @@ export async function playwrightExecutor( ); } const args = createArgs(options); - const p = runPlaywright(args, join(context.root, projectRoot)); + const p = runPlaywright(args, context.root); return new Promise<{ success: boolean }>((resolve) => { p.on('close', (code) => { diff --git a/packages/playwright/src/generators/configuration/configuration.ts b/packages/playwright/src/generators/configuration/configuration.ts index 6f5bd50ee55de..1dd0a11ed4b43 100644 --- a/packages/playwright/src/generators/configuration/configuration.ts +++ b/packages/playwright/src/generators/configuration/configuration.ts @@ -73,7 +73,11 @@ Rename or remove the existing e2e target.`); projectConfig.targets.e2e = { executor: '@nx/playwright:playwright', outputs: [`dist/.playwright/${projectConfig.root}`], - options: {}, + options: { + config: `${projectConfig.root}/playwright.config.${ + options.js ? 'js' : 'ts' + }`, + }, }; updateProjectConfiguration(tree, options.project, projectConfig); }