Skip to content

Commit f190263

Browse files
committed
fix(@angular/build): allow any CHROME_BIN for vitest playwright provider
The Playwright browser provider in Vitest now uses the `CHROME_BIN` environment variable as the executable path if it's set, removing the restriction that it must contain 'rules_browsers'. This is useful in CI environments to ensure a specific browser binary is used for testing in CI. Closes #32697
1 parent a19dc73 commit f190263

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

packages/angular/build/src/builders/unit-test/runners/vitest/browser-provider.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,14 @@ export async function setupBrowserConfiguration(
8888
// Validate that the imported module has the expected structure
8989
const providerFactory = providerModule[providerName];
9090
if (typeof providerFactory === 'function') {
91-
if (
92-
providerName === 'playwright' &&
93-
process.env['CHROME_BIN']?.includes('rules_browsers')
94-
) {
95-
// Use the Chrome binary from the 'rules_browsers' toolchain (via CHROME_BIN)
96-
// for Playwright when available to ensure hermetic testing, preventing reliance
97-
// on locally installed or NPM-managed browser versions.
98-
provider = providerFactory({
99-
launchOptions: {
100-
executablePath: process.env.CHROME_BIN,
101-
},
102-
contextOptions: {
103-
// Enables `prefer-color-scheme` for Vitest browser instead of `light`
104-
colorScheme: null,
105-
},
106-
});
107-
} else if (providerName === 'playwright') {
91+
if (providerName === 'playwright') {
92+
const executablePath = process.env['CHROME_BIN'];
10893
provider = providerFactory({
94+
launchOptions: executablePath
95+
? {
96+
executablePath,
97+
}
98+
: undefined,
10999
contextOptions: {
110100
// Enables `prefer-color-scheme` for Vitest browser instead of `light`
111101
colorScheme: null,

0 commit comments

Comments
 (0)