Skip to content

Commit

Permalink
refactor: update platform-browser tests to run as ESM (angular#48521)
Browse files Browse the repository at this point in the history
`platform-browser` tests now run in ESM and with `.mjs` output, so
the build targets and tests need to be updated.

Here we change the `zone_event_unpatched` script to include the
`.init` suffix that will be picked up by `spec_bundle`.

Also some circular dependency tests are updated to refer to the
`.mjs` files.

PR Close angular#48521
  • Loading branch information
devversion committed Dec 19, 2022
1 parent decae5b commit 653e122
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions karma-js.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function(config) {

// ZoneJS configuration needed for some event manager tests. This config could
// affect all legacy tests but in reality is scoped to certain special tests.
'packages/platform-browser/test/dom/events/zone_event_unpatched_init.js',
'packages/platform-browser/test/dom/events/zone_event_unpatched.init.js',

// Dependencies built by Bazel. See `config.yml` for steps running before
// the legacy Saucelabs tests run.
Expand All @@ -56,7 +56,7 @@ module.exports = function(config) {
{
pattern: 'node_modules/@webcomponents/custom-elements/**/*.js',
included: false,
watched: false
watched: false,
},

'node_modules/reflect-metadata/Reflect.js',
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-browser/animations/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test")

circular_dependency_test(
name = "circular_deps_test",
entry_point = "angular/packages/platform-browser/animations/index.js",
entry_point = "angular/packages/platform-browser/animations/index.mjs",
deps = ["//packages/platform-browser/animations"],
)

Expand Down
12 changes: 9 additions & 3 deletions packages/platform-browser/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
load("//tools/circular_dependency_test:index.bzl", "circular_dependency_test")

Expand All @@ -8,13 +9,13 @@ exports_files([

circular_dependency_test(
name = "circular_deps_test",
entry_point = "angular/packages/platform-browser/index.js",
entry_point = "angular/packages/platform-browser/index.mjs",
deps = ["//packages/platform-browser"],
)

circular_dependency_test(
name = "testing_circular_deps_test",
entry_point = "angular/packages/platform-browser/testing/index.js",
entry_point = "angular/packages/platform-browser/testing/index.mjs",
deps = ["//packages/platform-browser/testing"],
)

Expand All @@ -40,6 +41,11 @@ ts_library(
],
)

js_library(
name = "zone_event_unpatched_init_lib",
srcs = ["dom/events/zone_event_unpatched.init.js"],
)

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node"],
Expand All @@ -51,7 +57,7 @@ jasmine_node_test(
karma_web_test_suite(
name = "test_web",
bootstrap = [
"dom/events/zone_event_unpatched_init.js",
":zone_event_unpatched_init_lib",
],
static_files = [
":static_assets/test.html",
Expand Down

0 comments on commit 653e122

Please sign in to comment.