mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
To make our test output i.e. devmode output more aligned with what we produce in the NPM packages, or to be more aligned with what Angular applications will usually consume, the devmode output is switched from ES5 to ES2015. Additionally various tsconfigs (outside of Bazel) have been updated to match with the other parts of the build. The rules are: ES2015 for test configurations, ES2020 for actual code that will end up being shipped (this includes the IDE-only tsconfigs). PR Close #44505
112 lines
3.8 KiB
Text
112 lines
3.8 KiB
Text
load("@npm//@babel/cli:index.bzl", "babel")
|
|
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
ts_library(
|
|
name = "test_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
["**/*.ts"],
|
|
exclude = ["integration/**/*.ts"],
|
|
),
|
|
deps = [
|
|
"//packages/compiler",
|
|
"//packages/compiler-cli",
|
|
"//packages/compiler-cli/ngcc",
|
|
"//packages/compiler-cli/ngcc/test/helpers",
|
|
"//packages/compiler-cli/src/ngtsc/diagnostics",
|
|
"//packages/compiler-cli/src/ngtsc/file_system",
|
|
"//packages/compiler-cli/src/ngtsc/file_system/testing",
|
|
"//packages/compiler-cli/src/ngtsc/imports",
|
|
"//packages/compiler-cli/src/ngtsc/incremental/semantic_graph",
|
|
"//packages/compiler-cli/src/ngtsc/logging/testing",
|
|
"//packages/compiler-cli/src/ngtsc/partial_evaluator",
|
|
"//packages/compiler-cli/src/ngtsc/reflection",
|
|
"//packages/compiler-cli/src/ngtsc/sourcemaps",
|
|
"//packages/compiler-cli/src/ngtsc/testing",
|
|
"//packages/compiler-cli/src/ngtsc/transform",
|
|
"//packages/compiler-cli/src/ngtsc/translator",
|
|
"@npm//@types/convert-source-map",
|
|
"@npm//@types/yargs",
|
|
"@npm//dependency-graph",
|
|
"@npm//magic-string",
|
|
"@npm//sourcemap-codec",
|
|
"@npm//typescript",
|
|
],
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "test",
|
|
bootstrap = ["//tools/testing:node_no_angular_es2015"],
|
|
data = [
|
|
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
|
|
],
|
|
deps = [
|
|
":test_lib",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "integration_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
["integration/**/*.ts"],
|
|
),
|
|
deps = [
|
|
"//packages/compiler-cli/ngcc",
|
|
"//packages/compiler-cli/ngcc/test/helpers",
|
|
"//packages/compiler-cli/src/ngtsc/file_system",
|
|
"//packages/compiler-cli/src/ngtsc/file_system/testing",
|
|
"//packages/compiler-cli/src/ngtsc/logging/testing",
|
|
"//packages/compiler-cli/src/ngtsc/testing",
|
|
"@npm//rxjs",
|
|
"@npm//typescript",
|
|
],
|
|
)
|
|
|
|
# As of version 10, the release packages do not contain esm5 output anymore. The ngcc integration
|
|
# tests intend to test ES5 features though, so we downlevel the flat esm2015 file to ES5 using
|
|
# Babel. We can then link that into the mock file system as if the Angular core package is still
|
|
# built with previous APF versions where esm5 output was shipped. This allows us to ensure that ngcc
|
|
# properly processes libraries with esm5 output.
|
|
# **Note**: We are using Babel instead of `tsc` as TypeScript does not allow us to downlevel the
|
|
# file without setting the module resolution to either `amd` or `system`. We want to preserve ES
|
|
# modules.
|
|
babel(
|
|
name = "fesm5_angular_core",
|
|
outs = ["fesm5_angular_core.js"],
|
|
args = [
|
|
"$(execpath @npm//:node_modules/@angular/core-12/fesm2015/core.js)",
|
|
"--presets @babel/preset-env",
|
|
"--out-file $(execpath fesm5_angular_core.js)",
|
|
],
|
|
data = [
|
|
"@npm//:node_modules/@angular/core-12/fesm2015/core.js",
|
|
"@npm//@babel/preset-env",
|
|
],
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "integration",
|
|
timeout = "long",
|
|
bootstrap = ["//tools/testing:node_no_angular_es2015"],
|
|
data = [
|
|
":fesm5_angular_core",
|
|
"@npm//@angular/common-12",
|
|
"@npm//@angular/core-12",
|
|
"@npm//rxjs",
|
|
],
|
|
shard_count = 4,
|
|
tags = [],
|
|
templated_args = [
|
|
# TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver
|
|
# See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324
|
|
"--bazel_patch_module_resolver",
|
|
],
|
|
deps = [
|
|
":integration_lib",
|
|
"@npm//canonical-path",
|
|
"@npm//convert-source-map",
|
|
],
|
|
)
|