Skip to content

Commit

Permalink
refactor: remove vendored jest versions; user must provider their own…
Browse files Browse the repository at this point in the history
… jest-cli from their node_modules (#117)
  • Loading branch information
gregmagolan authored Apr 8, 2023
1 parent a486b66 commit 696c9b2
Show file tree
Hide file tree
Showing 79 changed files with 4,168 additions and 31,304 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jest_test(
data = [
"case3.test.js",
],
node_modules = "//:node_modules",
)

copy_to_bin(
Expand Down
8 changes: 0 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ nodejs_register_toolchains(
node_version = DEFAULT_NODE_VERSION,
)

load("//jest:repositories.bzl", "jest_repositories")

jest_repositories(name = "jest")

load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")

jest_npm_repositories()

# For running our own unit tests
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

Expand Down
12 changes: 6 additions & 6 deletions docs/rules.md

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

1 change: 1 addition & 0 deletions e2e/case4/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions e2e/case4/.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
6 changes: 5 additions & 1 deletion e2e/case4/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
load("@jest//:defs.bzl", "jest_test")
load("@aspect_rules_jest//jest:defs.bzl", "jest_test")
load("@npm//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages(name = "node_modules")

jest_test(
name = "case4",
config = "jest.config.js",
data = ["index.test.js"],
node_modules = "//:node_modules",
)
21 changes: 13 additions & 8 deletions e2e/case4/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ load("@aspect_rules_jest//jest:dependencies.bzl", "rules_jest_dependencies")

rules_jest_dependencies()

load("@aspect_rules_jest//jest:repositories.bzl", "jest_repositories")

jest_repositories(name = "jest")

load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")

jest_npm_repositories()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)

load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()
7 changes: 7 additions & 0 deletions e2e/case4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"private": true,
"devDependencies": {
"jest-cli": "29.5.0",
"jest-junit": "15.0.0"
}
}
Loading

0 comments on commit 696c9b2

Please sign in to comment.