From f08ec443ff3f0ee94a39ffb84a244ae1f4d9641c Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 20 Aug 2018 12:29:39 +0100 Subject: [PATCH] build: re-enable missing bazel tests --- packages/angular_devkit/core/BUILD | 17 +++------- packages/angular_devkit/schematics/BUILD | 32 +++++-------------- packages/schematics/angular/BUILD | 20 ++++++------ packages/schematics/update/BUILD | 22 ++++++------- .../tools/file-system-engine-host/BUILD | 31 ++++++++++++++++++ 5 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD diff --git a/packages/angular_devkit/core/BUILD b/packages/angular_devkit/core/BUILD index b561e04276..770dcf3adc 100644 --- a/packages/angular_devkit/core/BUILD +++ b/packages/angular_devkit/core/BUILD @@ -43,15 +43,7 @@ ts_library( "src/**/*_spec.ts", "src/**/*_spec_large.ts", ], - exclude = [ - # The workspace spec expects workspace.json to be there, but it's not. - # TODO(@filipesilva): figure out how to resolve these in bazel. - "src/workspace/workspace_spec.ts", - ], ), - data = [ - "src/workspace/workspace-schema.json" - ], deps = [ ":core", ":node", @@ -60,6 +52,10 @@ ts_library( # @typings: jasmine # @typings: node ], + data = [ + "src/workspace/workspace-schema.json", + "src/workspace/test/test-workspace.json" + ], ) jasmine_node_test( @@ -98,11 +94,6 @@ ts_library( "node/**/*_spec.ts", "node/**/*_spec_large.ts", ], - exclude = [ - # The node resolve spec uses the _devKitRoot global, which isn't available in Bazel. - # TODO(@filipesilva): figure out an alternative to that global. - "node/resolve_spec.ts", - ], ), deps = [ ":core", diff --git a/packages/angular_devkit/schematics/BUILD b/packages/angular_devkit/schematics/BUILD index 15fd6b53ae..db98352772 100644 --- a/packages/angular_devkit/schematics/BUILD +++ b/packages/angular_devkit/schematics/BUILD @@ -39,11 +39,6 @@ ts_library( "src/**/*_spec.ts", "src/**/*_spec_large.ts", ], - exclude = [ - # Instances of extended errors are showing Error as the constructor instead. - # TODO(@filipesilva): figure out why that is. - "src/rules/call_spec.ts", - ], ), deps = [ ":schematics", @@ -97,14 +92,10 @@ ts_library( "tasks/**/*_spec_large.ts", "tasks/tslint-fix/test/**/*.ts", ], - exclude = [ - # Disabled because 'collection.json' cannot be resolved in bazel. - # TODO(@filipesilva): figure out how to make data files resolve correctly. - "tasks/tslint-fix/executor_spec.ts", - ], ), data = [ "tasks/tslint-fix/test/collection.json", + "tasks/tslint-fix/test/rules/customRuleRule.js", ], deps = [ ":tasks", @@ -121,11 +112,10 @@ ts_library( ) -# Disabled since we are excluding the only test in tasks. -# jasmine_node_test( -# name = "tasks_test", -# srcs = [":tasks_test_lib"], -# ) +jasmine_node_test( + name = "tasks_test", + srcs = [":tasks_test_lib"], +) # @angular-devkit/schematics/tools @@ -137,6 +127,7 @@ ts_library( exclude = [ "tools/**/*_spec.ts", "tools/**/*_benchmark.ts", + "tools/test/**/*.ts", ], ), module_name = "@angular-devkit/schematics/tools", @@ -158,15 +149,8 @@ ts_library( include = [ "tools/**/*_spec.ts", "tools/**/*_spec_large.ts", + "tools/test/**/*.ts", ], - exclude = [ - # The node resolve spec uses the _devKitRoot global, which isn't available in Bazel. - # TODO(@filipesilva): figure out an alternative to that global. - "tools/file-system-engine-host_spec.ts", - ], - ), - data = glob( - include = ["tools/test/file-system-engine-host/**/collection.json"], ), deps = [ ":tools", @@ -175,6 +159,7 @@ ts_library( ":testing", "//packages/angular_devkit/core", "//packages/angular_devkit/core:node", + "//tests/angular_devkit/schematics/tools/file-system-engine-host:file_system_engine_host_test_lib", "@rxjs", "@rxjs//operators", # @typings: jasmine @@ -194,7 +179,6 @@ ts_library( name = "testing", srcs = glob( include = ["testing/**/*.ts"], - exclude = [], ), module_name = "@angular-devkit/schematics/testing", module_root = "testing/index.d.ts", diff --git a/packages/schematics/angular/BUILD b/packages/schematics/angular/BUILD index 1f6d7ae1d6..3613873f82 100644 --- a/packages/schematics/angular/BUILD +++ b/packages/schematics/angular/BUILD @@ -45,6 +45,13 @@ ts_library( "utility/test/**/*.ts" ], ), + data = glob( + include = [ + "**/*.json", + "*/files/**", + "*/other-files/**", + ] + ), deps = [ ":angular", "//packages/angular_devkit/core", @@ -57,12 +64,7 @@ ts_library( ], ) -# Disabled because 'collection.json' cannot be resolved in bazel, and all tests use it. -# TODO(@filipesilva): figure out how to make data files resolve correctly. -# jasmine_node_test( -# name = "angular_test", -# srcs = [":angular_test_lib"], -# data = [ -# "collection.json" -# ], -# ) +jasmine_node_test( + name = "angular_test", + srcs = [":angular_test_lib"], +) diff --git a/packages/schematics/update/BUILD b/packages/schematics/update/BUILD index 53a06f44e9..2d2a7edfb9 100644 --- a/packages/schematics/update/BUILD +++ b/packages/schematics/update/BUILD @@ -37,10 +37,11 @@ ts_library( "**/*_spec.ts", "**/*_spec_large.ts", ], - exclude = [ - # The purify spec also depends on the webpack typings so we ignore it. - # "src/purify/**", - ], + ), + data = glob( + include = [ + "**/*.json", + ] ), deps = [ ":update", @@ -54,12 +55,7 @@ ts_library( ], ) -# Disabled because 'collection.json' cannot be resolved in bazel, and all tests use it. -# TODO(@filipesilva): figure out how to make data files resolve correctly. -# jasmine_node_test( -# name = "update_test", -# srcs = [":update_test_lib"], -# data = [ -# "collection.json" -# ], -# ) \ No newline at end of file +jasmine_node_test( + name = "update_test", + srcs = [":update_test_lib"], +) \ No newline at end of file diff --git a/tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD b/tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD new file mode 100644 index 0000000000..dd3441d613 --- /dev/null +++ b/tests/angular_devkit/schematics/tools/file-system-engine-host/BUILD @@ -0,0 +1,31 @@ +# Copyright Google Inc. All Rights Reserved. +# +# Use of this source code is governed by an MIT-style license that can be +# found in the LICENSE file at https://angular.io/license +package(default_visibility = ["//visibility:public"]) + +load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") + +licenses(["notice"]) # MIT License + +ts_library( + name = "file_system_engine_host_test_lib", + srcs = glob( + include = [ + "**/*.ts", + ], + ), + data = glob( + include = ["**/collection.json"], + ), + deps = [ + "//packages/angular_devkit/schematics:schematics", + # ":testing", + # "//packages/angular_devkit/core", + # "//packages/angular_devkit/core:node", + # "@rxjs", + # "@rxjs//operators", + # @typings: jasmine + # @typings: node + ], +) \ No newline at end of file