Skip to content

Commit

Permalink
fix: pass env to Playwright test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfgreffier committed Oct 23, 2024
1 parent 35a229d commit 86c6949
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/builders/playwright/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ describe('Playwright builder', () => {
'npx playwright test',
[],
expect.objectContaining({
env: { PLAYWRIGHT_TEST_BASE_URL: 'https://example.com' },
env: expect.objectContaining({
PLAYWRIGHT_TEST_BASE_URL: 'https://example.com',
}),
}),
);
});
Expand Down
3 changes: 2 additions & 1 deletion src/builders/playwright/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ async function startPlaywrightTest(options: Options, baseURL: string) {
// PLAYWRIGHT_TEST_BASE_URL is actually a non-documented env variable used
// by Playwright Test.
// Its usage in playwright.config.ts is to clarify that it can be overriden.
let env = {};
let env = process.env;
if (baseURL) {
env = {
PLAYWRIGHT_TEST_BASE_URL: baseURL,
...process.env,
};
}

Expand Down

0 comments on commit 86c6949

Please sign in to comment.