Skip to content

Commit

Permalink
build: enable importHelpers in tsconfig
Browse files Browse the repository at this point in the history
This is the primary tsconfig file used for Bazel builds.
Previously, we enabled this option only for releases.
  • Loading branch information
alexeagle committed Mar 16, 2018
1 parent 44de10e commit 81aeacc
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 92 deletions.
3 changes: 3 additions & 0 deletions packages/bazel/test/ng_package/core_package.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ describe('@angular/core ng_package', () => {
expect(shx.cat('bundles/core.umd.js'))
.toMatch(/@license Angular v\d+\.\d+\.\d+(?!-PLACEHOLDER)/);
});

it('should have tslib helpers',
() => { expect(shx.cat('bundles/core.umd.js')).not.toContain('undefined.__extends'); });
});
});

Expand Down
8 changes: 1 addition & 7 deletions packages/common/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -32,12 +31,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
10 changes: 2 additions & 8 deletions packages/compiler/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -49,14 +48,9 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
# disable since tests are running but not yet passing
tags = ["manual"],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
8 changes: 1 addition & 7 deletions packages/core/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -62,12 +61,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
8 changes: 1 addition & 7 deletions packages/core/test/render3/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -57,12 +56,7 @@ jasmine_node_test(

ts_web_test(
name = "render3_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":render3_lib",
],
)
8 changes: 1 addition & 7 deletions packages/forms/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -27,12 +26,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
8 changes: 1 addition & 7 deletions packages/http/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -28,12 +27,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
6 changes: 2 additions & 4 deletions packages/language-service/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand All @@ -16,10 +15,9 @@ ts_library(
jasmine_node_test(
name = "test",
bootstrap = ["angular/tools/testing/init_node_spec.js"],
# dissable since tests are running but not yet passing
# disable since tests are running but not yet passing
tags = ["manual"],
deps = [
":test_lib",
"//tools/testing:node",
],
)
10 changes: 2 additions & 8 deletions packages/platform-browser-dynamic/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -30,14 +29,9 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
# disable since tests are running but not yet passing
tags = ["manual"],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
10 changes: 2 additions & 8 deletions packages/platform-browser/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -36,14 +35,9 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# dissable since tests are running but not yet passing
# disable since tests are running but not yet passing
tags = ["manual"],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
1 change: 0 additions & 1 deletion packages/platform-server/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down
8 changes: 1 addition & 7 deletions packages/platform-webworker/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -30,12 +29,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
8 changes: 1 addition & 7 deletions packages/router/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -31,12 +30,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
8 changes: 1 addition & 7 deletions packages/service-worker/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand Down Expand Up @@ -29,12 +28,7 @@ jasmine_node_test(

ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
3 changes: 2 additions & 1 deletion packages/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
// As tsickle will lower decorators before TS, this is not a problem for our build.
"emitDecoratorMetadata": true,
"sourceMap": true,
"inlineSources": true
"inlineSources": true,
"importHelpers": true
},
"bazelOptions": {
"suppressTsconfigOverrideWarnings": true
Expand Down
6 changes: 1 addition & 5 deletions packages/upgrade/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test")
load("//tools:defaults.bzl", "ts_library", "ts_web_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")

ts_library(
Expand All @@ -22,16 +21,13 @@ ts_library(
ts_web_test(
name = "test_web",
bootstrap = [
"//:web_test_bootstrap_scripts",
# "//:angularjs",
],
# Disable since tests need to request different AngularJS versions at
# runtime, which is not yet supported.
# (Related issue: https://github.com/bazelbuild/rules_typescript/issues/131)
tags = ["manual"],
# do not sort
deps = [
"//tools/testing:browser",
":test_lib",
],
)
15 changes: 14 additions & 1 deletion tools/defaults.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Re-export of some bazel rules with repository-wide defaults."""
load("@build_bazel_rules_nodejs//:defs.bzl", _npm_package = "npm_package")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library", _ts_web_test = "ts_web_test")
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")

DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
Expand Down Expand Up @@ -66,3 +66,16 @@ def npm_package(name, replacements = {}, **kwargs):
stamp_data = "//tools:stamp_data",
replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS),
**kwargs)

def ts_web_test(bootstrap = [], deps = [], **kwargs):
if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"]
local_deps = [
"//:node_modules/tslib/tslib.js",
"//tools/testing:browser",
] + deps

_ts_web_test(
bootstrap = bootstrap,
deps = local_deps,
**kwargs)

0 comments on commit 81aeacc

Please sign in to comment.