Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 2, 2024
1 parent 0c1d9ce commit 18fbe17
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions e2e/bzlmod/.bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
other_module
5 changes: 5 additions & 0 deletions e2e/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ build_test(
name = "node_modules_test",
targets = ["//:node_modules"],
)

build_test(
name = "other_module_binary_test",
targets = ["@other_module//:pyright"],
)
6 changes: 6 additions & 0 deletions e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "other_module")
local_path_override(
module_name = "other_module",
path = "other_module",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.7", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

Expand Down
1 change: 1 addition & 0 deletions e2e/bzlmod/other_module/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions e2e/bzlmod/other_module/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Disabling pnpm [hoisting](https://pnpm.io/npmrc#hoist) by setting `hoist=false` is recommended on
# projects using rules_js so that pnpm outside of Bazel lays out a node_modules tree similar to what
# rules_js lays out under Bazel (without a hidden node_modules/.pnpm/node_modules)
hoist=false
10 changes: 10 additions & 0 deletions e2e/bzlmod/other_module/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@npm_other_module//:defs.bzl", "npm_link_all_packages")
load("@npm_other_module//:pyright/package_json.bzl", pyright = "bin")

npm_link_all_packages(name = "node_modules")

pyright.pyright_binary(
name = "pyright",
env = {"BAZEL_BINDIR": "."}, # Allow the binary to be run outside bazel
visibility = ["//visibility:public"],
)
12 changes: 12 additions & 0 deletions e2e/bzlmod/other_module/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module(name = "other_module")

bazel_dep(name = "aspect_rules_js", version = "0.0.0")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm_other_module",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm_other_module")
2 changes: 2 additions & 0 deletions e2e/bzlmod/other_module/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Marker file that this folder is the root of a Bazel workspace.
# See MODULE.bazel for dependencies and setup.
5 changes: 5 additions & 0 deletions e2e/bzlmod/other_module/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"pyright": "1.1.373"
}
}
37 changes: 37 additions & 0 deletions e2e/bzlmod/other_module/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions e2e/pnpm_lockfiles/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module(name = "foo", repo_name = "my_foo")

bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
Expand Down

0 comments on commit 18fbe17

Please sign in to comment.