Skip to content

Commit 9e292f1

Browse files
committed
fix(@angular/build): exclude @vitest/browser/context from esbuild bundling
Bundling this module causes unit tests to fail with `@vitest/browser/context can be imported only inside the Browser Mode. Your test is running in browser pool. Make sure your regular tests are excluded from the "test.include" glob pattern.`, This is because `@vitest/browser/context` is a virtual mode in vite and the package on NPM is dummy that is used for static analysis. Closes: #30677
1 parent 1ef02b7 commit 9e292f1

File tree

1 file changed

+5
-1
lines changed
  • packages/angular/build/src/builders/unit-test

1 file changed

+5
-1
lines changed

packages/angular/build/src/builders/unit-test/builder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ export async function* execute(
138138
optimization: false,
139139
tsConfig: normalizedOptions.tsConfig,
140140
entryPoints,
141-
externalDependencies: ['vitest', ...(buildTargetOptions.externalDependencies ?? [])],
141+
externalDependencies: [
142+
'vitest',
143+
'@vitest/browser/context',
144+
...(buildTargetOptions.externalDependencies ?? []),
145+
],
142146
};
143147
extensions ??= {};
144148
extensions.codePlugins ??= [];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy