build: cleanup //tools/ts-api-guardian:tests target (#34589)

PR Close #34589
This commit is contained in:
Greg Magolan 2020-01-08 01:30:07 -08:00 committed by atscott
parent 753b5bc305
commit 7a63e4f7d5
2 changed files with 6 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# BEGIN-INTERNAL # BEGIN-INTERNAL
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library") load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//tools:defaults.bzl", "jasmine_node_test")
ts_library( ts_library(
name = "lib", name = "lib",
@ -95,16 +95,13 @@ jasmine_node_test(
srcs = [ srcs = [
":test_lib", ":test_lib",
], ],
bootstrap = [":bootstrap_es5"],
data = glob([ data = glob([
"test/fixtures/*.ts", "test/fixtures/*.ts",
"test/fixtures/*.patch", "test/fixtures/*.patch",
]) + [ ]) + [
":bootstrap_es5",
":ts-api-guardian", ":ts-api-guardian",
# TODO: remove this once the boostrap.js workaround has been removed.
":package.json",
], ],
templated_args = ["--node_options=--require=$(rlocation $(location :bootstrap_es5))"],
) )
# END-INTERNAL # END-INTERNAL

View File

@ -6,13 +6,11 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import * as path from 'path'; const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']);
// Resolve the path to the package.json of the ts-api-guardian. We need to resolve an actual // Change directories to the path of the ts-api-guardian source tree. We need to resolve an actual
// path of a runfile because we want to determine the path to the directory that includes all // path of a tree because we want to determine the path to the directory that includes all
// test fixture runfiles. On Windows this is usually the original non-sandboxed disk location, // test fixture runfiles. On Windows this is usually the original non-sandboxed disk location,
// otherwise this just refers to the runfile directory with all the proper symlinked files. // otherwise this just refers to the runfile directory with all the proper symlinked files.
// TODO: remove the whole bootstrap file once the tests are Bazel and Windows compatible. // TODO: remove the whole bootstrap file once the tests are Bazel and Windows compatible.
const runfilesDirectory = path.dirname(require.resolve('../package.json')); process.chdir(runfiles.resolve('angular/tools/ts-api-guardian'));
process.chdir(runfilesDirectory);