@@ -8,13 +8,13 @@ load("@npm//@angular/build-tooling/bazel/integration:index.bzl", _integration_te
88load ("@npm//@angular/build-tooling/bazel/esbuild:index.bzl" , _esbuild = "esbuild" , _esbuild_config = "esbuild_config" )
99load ("@npm//@angular/build-tooling/bazel/http-server:index.bzl" , _http_server = "http_server" )
1010load ("@npm//@angular/build-tooling/bazel:extract_js_module_output.bzl" , "extract_js_module_output" )
11- load ("@npm//@bazel/protractor:index.bzl" , _protractor_web_test_suite = "protractor_web_test_suite" )
1211load ("//:packages.bzl" , "NO_STAMP_NPM_PACKAGE_SUBSTITUTIONS" , "NPM_PACKAGE_SUBSTITUTIONS" )
1312load ("//:pkg-externals.bzl" , "PKG_EXTERNALS" )
1413load ("//tools/markdown-to-html:index.bzl" , _markdown_to_html = "markdown_to_html" )
1514load ("//tools/extract-tokens:index.bzl" , _extract_tokens = "extract_tokens" )
1615load ("//tools/bazel:ng_package_interop.bzl" , "ng_package_interop" )
1716load ("//tools:defaults2.bzl" , "spec_bundle" , _karma_web_test_suite = "karma_web_test_suite" )
17+ load ("@npm//@bazel/protractor:index.bzl" , _protractor_web_test_suite = "protractor_web_test_suite" )
1818
1919npmPackageSubstitutions = select ({
2020 "//tools:stamp" : NPM_PACKAGE_SUBSTITUTIONS ,
@@ -190,21 +190,7 @@ def node_integration_test(setup_chromium = False, node_repository = "nodejs", **
190190 ** kwargs
191191 )
192192
193- def ng_web_test_suite (deps = [], static_css = [], exclude_init_script = False , ** kwargs ):
194- bootstrap = [
195- # This matches the ZoneJS bundles used in default CLI projects. See:
196- # https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/application/files/src/polyfills.ts.template#L58
197- # https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/application/files/src/test.ts.template#L3
198- # Note `zone.js/dist/zone.js` is aliased in the CLI to point to the evergreen
199- # output that does not include legacy patches. See: https://github.com/angular/angular/issues/35157.
200- # TODO: Consider adding the legacy patches when testing Saucelabs/Browserstack with Bazel.
201- # CLI loads the legacy patches conditionally for ES5 legacy browsers. See:
202- # https://github.com/angular/angular-cli/blob/277bad3895cbce6de80aa10a05c349b10d9e09df/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L141
203- "@npm//:node_modules/zone.js/bundles/zone.umd.js" ,
204- "@npm//:node_modules/zone.js/bundles/zone-testing.umd.js" ,
205- "@npm//:node_modules/reflect-metadata/Reflect.js" ,
206- ] + kwargs .pop ("bootstrap" , [])
207-
193+ def ng_web_test_suite (deps = [], static_css = [], ** kwargs ):
208194 # Always include a prebuilt theme in the test suite because otherwise tests, which depend on CSS
209195 # that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme
210196 # reduces the amount of setup that is needed to create a test suite Bazel target. Note that the
@@ -213,6 +199,8 @@ def ng_web_test_suite(deps = [], static_css = [], exclude_init_script = False, *
213199 "//src/material/prebuilt-themes:azure-blue" ,
214200 ]
215201
202+ bootstrap = []
203+
216204 # Workaround for https://github.com/bazelbuild/rules_typescript/issues/301
217205 # Since some of our tests depend on CSS files which are not part of the `ng_project` rule,
218206 # we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles
@@ -226,7 +214,7 @@ def ng_web_test_suite(deps = [], static_css = [], exclude_init_script = False, *
226214 native .genrule (
227215 name = css_id ,
228216 srcs = [css_label ],
229- outs = ["%s.css.js" % css_id ],
217+ outs = ["%s.css.init. js" % css_id ],
230218 output_to_bindir = True ,
231219 cmd = """
232220 files=($(execpaths %s))
@@ -244,8 +232,8 @@ def ng_web_test_suite(deps = [], static_css = [], exclude_init_script = False, *
244232
245233 karma_web_test_suite (
246234 # Depend on our custom test initialization script. This needs to be the first dependency.
247- deps = deps if exclude_init_script else [ "//test:angular_test_init" ] + deps ,
248- bootstrap = bootstrap ,
235+ deps = deps ,
236+ bootstrap = [ "//test:angular_test_init" ] + bootstrap ,
249237 ** kwargs
250238 )
251239
0 commit comments