diff --git a/examples/bazel_managed_deps/BUILD.bazel b/examples/bazel_managed_deps/BUILD.bazel index fe2d6e1776..8188415c08 100644 --- a/examples/bazel_managed_deps/BUILD.bazel +++ b/examples/bazel_managed_deps/BUILD.bazel @@ -6,6 +6,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") jasmine_node_test( name = "test", srcs = glob(["*.spec.js"]), + data = ["@npm//:bin_files"], node_modules = "@npm//:node_modules", ) @@ -15,6 +16,7 @@ jasmine_node_test( jasmine_node_test( name = "fine_grained_test", srcs = glob(["*.spec.js"]), + data = ["@npm//:bin_files"], deps = [ "@npm//jasmine", "@npm//typescript", diff --git a/examples/bazel_managed_deps/WORKSPACE b/examples/bazel_managed_deps/WORKSPACE index 4046eb718e..bc18d16ac9 100644 --- a/examples/bazel_managed_deps/WORKSPACE +++ b/examples/bazel_managed_deps/WORKSPACE @@ -33,6 +33,11 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install") # @npm//jasmine yarn_install( name = "npm", + manual_build_file_contents = """ +filegroup( + name = "bin_files", + srcs = glob(["node_modules/.bin/*"]), +)""", package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) diff --git a/examples/bazel_managed_deps/deps.spec.js b/examples/bazel_managed_deps/deps.spec.js index 03fe3a5cb8..ae1ee3c2ba 100644 --- a/examples/bazel_managed_deps/deps.spec.js +++ b/examples/bazel_managed_deps/deps.spec.js @@ -10,4 +10,15 @@ describe('dependencies', () => { () => { require('jasmine-core'); }); + + it('.bin files should be in runfiles via @npm//:bin_files data dep', () => { + const files = ['jasmine', 'tsc', 'tsserver']; + for (const f of files) { + try { + expect(require.resolve(`.bin/${f}`).endsWith(`/npm/node_modules/.bin/${f}`)).toBe(true); + } catch (_) { + fail(`.bin/${f} not resolved`); + } + } + }); });