diff --git a/examples/user_managed_deps/BUILD.bazel b/examples/user_managed_deps/BUILD.bazel index 0f2488a7a5..9c930789b5 100644 --- a/examples/user_managed_deps/BUILD.bazel +++ b/examples/user_managed_deps/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") # Make the jasmine library available at runtime by exposing our node_modules # directory. @@ -41,8 +41,8 @@ nodejs_binary( jasmine_node_test( name = "test", srcs = glob(["*.spec.js"]), - jasmine_deps = [], node_modules = "//:node_modules", + tags = ["no-local-jasmine-deps"], deps = [ ":decrement", ":program", diff --git a/internal/common/test/BUILD.bazel b/internal/common/test/BUILD.bazel index c34220e06b..2e8cb675b9 100644 --- a/internal/common/test/BUILD.bazel +++ b/internal/common/test/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("//internal/common:copy_to_bin.bzl", "copy_to_bin") load("//internal/common:params_file.bzl", "params_file") load(":expand_into_runfiles_test.bzl", "expand_into_runfiles_test_suite") diff --git a/internal/linker/test/BUILD.bazel b/internal/linker/test/BUILD.bazel index a95340992e..3dc2809225 100644 --- a/internal/linker/test/BUILD.bazel +++ b/internal/linker/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") ts_library( diff --git a/internal/linker/test/local/BUILD.bazel b/internal/linker/test/local/BUILD.bazel index 0ebecfed71..28bcecd18e 100644 --- a/internal/linker/test/local/BUILD.bazel +++ b/internal/linker/test/local/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") jasmine_node_test( name = "test", diff --git a/internal/node/test/BUILD.bazel b/internal/node/test/BUILD.bazel index 3a2fcae006..026feec926 100644 --- a/internal/node/test/BUILD.bazel +++ b/internal/node/test/BUILD.bazel @@ -1,7 +1,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test", "npm_package_bin") load("@build_bazel_rules_nodejs//internal/golden_file_test:golden_file_test.bzl", "golden_file_test") load("@npm//typescript:index.bzl", "tsc") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("//internal/js_library:js_library.bzl", "js_library") load("//internal/node:node_repositories.bzl", "BUILT_IN_NODE_PLATFORMS") load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") diff --git a/internal/npm_install/test/BUILD.bazel b/internal/npm_install/test/BUILD.bazel index 4310039ca9..4c649323cf 100644 --- a/internal/npm_install/test/BUILD.bazel +++ b/internal/npm_install/test/BUILD.bazel @@ -1,6 +1,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@build_bazel_rules_nodejs//internal/npm_install:npm_umd_bundle.bzl", "npm_umd_bundle") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") filegroup( name = "goldens", @@ -101,11 +101,12 @@ sh_test( "coarse.spec.js", "common.spec.js", ], - jasmine_deps = [ + node_modules = "@fine_grained_deps_%s//:node_modules" % pkgmgr, + tags = ["no-local-jasmine-deps"], + deps = [ "@fine_grained_deps_%s//jasmine" % pkgmgr, "@fine_grained_deps_%s//jasmine-core" % pkgmgr, ], - node_modules = "@fine_grained_deps_%s//:node_modules" % pkgmgr, ) for pkgmgr in [ "yarn", "npm", @@ -120,11 +121,10 @@ sh_test( "common.spec.js", "fine.spec.js", ], - jasmine_deps = [ + tags = ["no-local-jasmine-deps"], + deps = [ "@fine_grained_deps_%s//jasmine" % pkgmgr, "@fine_grained_deps_%s//jasmine-core" % pkgmgr, - ], - deps = [ "@fine_grained_deps_%s//ajv" % pkgmgr, "@fine_grained_deps_%s//typescript" % pkgmgr, "@fine_grained_deps_%s//rxjs" % pkgmgr, diff --git a/internal/pkg_npm/test/BUILD.bazel b/internal/pkg_npm/test/BUILD.bazel index cd21ec3bd8..db77e8684e 100644 --- a/internal/pkg_npm/test/BUILD.bazel +++ b/internal/pkg_npm/test/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_typescript//:index.bzl", "ts_library") load("//internal/node:context.bzl", "node_context_data") diff --git a/internal/pkg_web/BUILD.bazel b/internal/pkg_web/BUILD.bazel index f432a8aadb..027530c9dd 100644 --- a/internal/pkg_web/BUILD.bazel +++ b/internal/pkg_web/BUILD.bazel @@ -2,7 +2,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") # BEGIN-INTERNAL -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") # END-INTERNAL package(default_visibility = ["//visibility:public"]) diff --git a/internal/pkg_web/test/BUILD.bazel b/internal/pkg_web/test/BUILD.bazel index ba8ca7337c..ba779006b6 100644 --- a/internal/pkg_web/test/BUILD.bazel +++ b/internal/pkg_web/test/BUILD.bazel @@ -1,6 +1,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web") load("@npm//@babel/cli:index.bzl", "babel") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_terser//:index.bzl", "terser_minified") load("@npm_bazel_typescript//:index.bzl", "ts_library") diff --git a/internal/pkg_web/test2/BUILD.bazel b/internal/pkg_web/test2/BUILD.bazel index fe51084aa8..05d6bc3237 100644 --- a/internal/pkg_web/test2/BUILD.bazel +++ b/internal/pkg_web/test2/BUILD.bazel @@ -1,6 +1,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web") load("@npm//@babel/cli:index.bzl", "babel") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_terser//:index.bzl", "terser_minified") diff --git a/packages/jasmine/BUILD.bazel b/packages/jasmine/BUILD.bazel index d887e8366c..bf9dabb8b0 100644 --- a/packages/jasmine/BUILD.bazel +++ b/packages/jasmine/BUILD.bazel @@ -42,6 +42,10 @@ pkg_npm( "@npm_bazel_jasmine//:package_contents", ], build_file_content = "", + substitutions = { + "@npm_bazel_jasmine//:jasmine__pkg": "@npm//@bazel/jasmine", + "@npm_bazel_jasmine//:jasmine_runner.js": "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js", + }, vendor_external = [ "npm_bazel_jasmine", ], diff --git a/packages/jasmine/src/index.from_src.bzl b/packages/jasmine/src/index.from_src.bzl deleted file mode 100644 index 8303bc2c39..0000000000 --- a/packages/jasmine/src/index.from_src.bzl +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2019 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Defaults for usage without @npm//@bazel/jasmine -""" - -load(":index.bzl", _jasmine_node_test = "jasmine_node_test") - -def jasmine_node_test( - deps = [], - jasmine_deps = ["@npm//jasmine", "@npm//jasmine-core", "@npm//jasmine-reporters", "@npm//v8-coverage"], - **kwargs): - _jasmine_node_test( - # When there is no @npm//@bazel/jasmine package we use @npm_bazel_jasmine instead. - # @npm//jasmine dependency must also be added manually since without a dep on - # @npm//@bazel/jasmine it will not be added automatically. - deps = deps + jasmine_deps, - jasmine = "@npm_bazel_jasmine//:jasmine__pkg", - jasmine_entry_point = "@npm_bazel_jasmine//:jasmine_runner.js", - **kwargs - ) diff --git a/packages/jasmine/src/jasmine_node_test.bzl b/packages/jasmine/src/jasmine_node_test.bzl index 6c38bb5585..a1706fa971 100644 --- a/packages/jasmine/src/jasmine_node_test.bzl +++ b/packages/jasmine/src/jasmine_node_test.bzl @@ -63,8 +63,10 @@ def jasmine_node_test( tags = [], config_file = None, coverage = False, - jasmine = "@npm//@bazel/jasmine", - jasmine_entry_point = "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js", + # Replaced by pkg_npm with jasmine = "@npm//@bazel/jasmine", + jasmine = "@npm_bazel_jasmine//:jasmine__pkg", + # Replaced by pkg_npm with jasmine_entry_point = "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js", + jasmine_entry_point = "@npm_bazel_jasmine//:jasmine_runner.js", **kwargs): """Runs tests in NodeJS using the Jasmine test runner. @@ -104,6 +106,13 @@ def jasmine_node_test( all_data = data + srcs + deps + [Label(jasmine)] + # BEGIN-INTERNAL + # Only used when running tests in the rules_nodejs repo. + # Avoid adding duplicate deps though, some rules use this from source and declared the dep + if not "@npm//jasmine" in all_data and not str(Label("@npm//jasmine")) in all_data and not "no-local-jasmine-deps" in tags: + all_data.extend(["@npm//jasmine", "@npm//jasmine-reporters", "@npm//v8-coverage"]) + + # END-INTERNAL all_data += [":%s_devmode_srcs.MF" % name] all_data += [Label("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel/tools/bash/runfiles")] diff --git a/packages/jasmine/test/BUILD.bazel b/packages/jasmine/test/BUILD.bazel index 728b424fa2..cd6f20c0b0 100644 --- a/packages/jasmine/test/BUILD.bazel +++ b/packages/jasmine/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("//internal/common:copy_to_bin.bzl", "copy_to_bin") jasmine_node_test( diff --git a/packages/karma/test/karma_typescript/BUILD.bazel b/packages/karma/test/karma_typescript/BUILD.bazel index c282a8a1e7..245d8c5937 100644 --- a/packages/karma/test/karma_typescript/BUILD.bazel +++ b/packages/karma/test/karma_typescript/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite") load("@npm_bazel_typescript//:index.bzl", "ts_library") diff --git a/packages/labs/test/grpc_web/BUILD.bazel b/packages/labs/test/grpc_web/BUILD.bazel index b26a91c705..5dc3fc6f78 100644 --- a/packages/labs/test/grpc_web/BUILD.bazel +++ b/packages/labs/test/grpc_web/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_typescript//:index.bzl", "ts_library") diff --git a/packages/labs/test/protobufjs/BUILD.bazel b/packages/labs/test/protobufjs/BUILD.bazel index f4cb9e044d..1d02d1eb49 100644 --- a/packages/labs/test/protobufjs/BUILD.bazel +++ b/packages/labs/test/protobufjs/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_labs//:index.bzl", "protobufjs_ts_library") load("@npm_bazel_typescript//:index.bzl", "ts_library") load("@rules_proto//proto:defs.bzl", "proto_library") diff --git a/packages/protractor/test/protractor-utils/BUILD.bazel b/packages/protractor/test/protractor-utils/BUILD.bazel index 4a5ee027b9..d2917afbee 100644 --- a/packages/protractor/test/protractor-utils/BUILD.bazel +++ b/packages/protractor/test/protractor-utils/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") ts_library( diff --git a/packages/rollup/test/code_splitting/BUILD.bazel b/packages/rollup/test/code_splitting/BUILD.bazel index 0316fe3e66..98fb55a896 100644 --- a/packages/rollup/test/code_splitting/BUILD.bazel +++ b/packages/rollup/test/code_splitting/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") rollup_bundle( diff --git a/packages/rollup/test/multiple_entry_points/BUILD.bazel b/packages/rollup/test/multiple_entry_points/BUILD.bazel index adf2289bb8..7e000d8ba4 100644 --- a/packages/rollup/test/multiple_entry_points/BUILD.bazel +++ b/packages/rollup/test/multiple_entry_points/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") rollup_bundle( diff --git a/packages/rollup/test/sourcemaps/BUILD.bazel b/packages/rollup/test/sourcemaps/BUILD.bazel index de8182174e..4072eb4ef7 100644 --- a/packages/rollup/test/sourcemaps/BUILD.bazel +++ b/packages/rollup/test/sourcemaps/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") rollup_bundle( diff --git a/packages/terser/test/BUILD.bazel b/packages/terser/test/BUILD.bazel index 9300894b72..e9840b78f9 100644 --- a/packages/terser/test/BUILD.bazel +++ b/packages/terser/test/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") jasmine_node_test( name = "test", diff --git a/packages/terser/test/directory_input/BUILD.bazel b/packages/terser/test/directory_input/BUILD.bazel index 6727e7ee89..2fbbd7c77d 100644 --- a/packages/terser/test/directory_input/BUILD.bazel +++ b/packages/terser/test/directory_input/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:tools/declare_directory.bzl", "declare_directory") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_terser//:index.bzl", "terser_minified") declare_directory( diff --git a/packages/terser/test/exec/BUILD.bazel b/packages/terser/test/exec/BUILD.bazel index 9e44e659e8..74aeff57cc 100644 --- a/packages/terser/test/exec/BUILD.bazel +++ b/packages/terser/test/exec/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") jasmine_node_test( name = "test", diff --git a/packages/terser/test/inline_sourcemap/BUILD.bazel b/packages/terser/test/inline_sourcemap/BUILD.bazel index cb6f1f4c77..d3f3a9ddb2 100644 --- a/packages/terser/test/inline_sourcemap/BUILD.bazel +++ b/packages/terser/test/inline_sourcemap/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_terser//:index.bzl", "terser_minified") # Check that filegroups work diff --git a/packages/terser/test/sourcemap/BUILD.bazel b/packages/terser/test/sourcemap/BUILD.bazel index 46365c57a5..c96af27f16 100644 --- a/packages/terser/test/sourcemap/BUILD.bazel +++ b/packages/terser/test/sourcemap/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:tools/declare_directory.bzl", "declare_directory") -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_terser//:index.bzl", "terser_minified") filegroup( diff --git a/packages/typescript/test/angular_plugin/compiled_output/BUILD.bazel b/packages/typescript/test/angular_plugin/compiled_output/BUILD.bazel index 74be7b3c2b..8318277cd9 100644 --- a/packages/typescript/test/angular_plugin/compiled_output/BUILD.bazel +++ b/packages/typescript/test/angular_plugin/compiled_output/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") ts_library( diff --git a/packages/typescript/test/googmodule/BUILD.bazel b/packages/typescript/test/googmodule/BUILD.bazel index 5cc39092b4..a7709815e8 100644 --- a/packages/typescript/test/googmodule/BUILD.bazel +++ b/packages/typescript/test/googmodule/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") load("//packages/typescript/test/devmode_consumer:devmode_consumer.bzl", "devmode_consumer") diff --git a/packages/typescript/test/reference_types_directive/BUILD.bazel b/packages/typescript/test/reference_types_directive/BUILD.bazel index 975dadc9fb..a984b223fe 100644 --- a/packages/typescript/test/reference_types_directive/BUILD.bazel +++ b/packages/typescript/test/reference_types_directive/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") ts_library( diff --git a/packages/typescript/test/target_module_attributes/BUILD.bazel b/packages/typescript/test/target_module_attributes/BUILD.bazel index 96c21abffb..746fd9e7ed 100644 --- a/packages/typescript/test/target_module_attributes/BUILD.bazel +++ b/packages/typescript/test/target_module_attributes/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") load("//packages/typescript/test/devmode_consumer:devmode_consumer.bzl", "devmode_consumer") load("//packages/typescript/test/es6_consumer:es6_consumer.bzl", "es6_consumer") diff --git a/packages/typescript/test/ts_project/b/BUILD.bazel b/packages/typescript/test/ts_project/b/BUILD.bazel index 22304b501c..b7174ad0b8 100644 --- a/packages/typescript/test/ts_project/b/BUILD.bazel +++ b/packages/typescript/test/ts_project/b/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test") +load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_project") package(default_visibility = ["//packages/typescript/test:__subpackages__"])