Skip to content

Commit

Permalink
Update integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhys Madigan committed May 12, 2024
1 parent 4124590 commit fb8e41d
Show file tree
Hide file tree
Showing 8 changed files with 1,438 additions and 938 deletions.
13 changes: 1 addition & 12 deletions src/python/pants/backend/javascript/install_node_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@
from pants.engine.internals.selectors import Get
from pants.engine.process import ProcessResult
from pants.engine.rules import Rule, collect_rules, rule
from pants.engine.target import (
SourcesField,
Target,
TransitiveTargets,
TransitiveTargetsRequest,
targets_with_sources_types,
)
from pants.engine.target import SourcesField, Target, TransitiveTargets, TransitiveTargetsRequest
from pants.engine.unions import UnionMembership, UnionRule


Expand Down Expand Up @@ -86,11 +80,6 @@ async def install_node_packages_for_address(
target = project_env.ensure_target()
transitive_tgts = await Get(TransitiveTargets, TransitiveTargetsRequest([target.address]))

pkg_tgts = targets_with_sources_types(
[PackageJsonSourceField], transitive_tgts.dependencies, union_membership
)
assert target not in pkg_tgts

source_files = await _get_relevant_source_files(
(tgt[SourcesField] for tgt in transitive_tgts.closure if tgt.has_field(SourcesField)),
with_js=False,
Expand Down
8 changes: 3 additions & 5 deletions src/python/pants/backend/javascript/nodejs_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,9 @@ async def find_node_js_projects(
# Note: If pnpm_workspace.yaml is present for an npm-managed project, it will override the package.json["workspaces"] setting, which is not intuitive
# Probably pnpm_workspace.yaml should only be used for pnpm projects.
project_paths = (
(
ProjectPaths(pkg.root_dir, ["", *pkg.workspaces])
if pkg not in pnpm_workspaces
else ProjectPaths(pkg.root_dir, ["", *pnpm_workspaces[pkg].packages])
)
ProjectPaths(pkg.root_dir, ["", *pkg.workspaces])
if pkg not in pnpm_workspaces
else ProjectPaths(pkg.root_dir, ["", *pnpm_workspaces[pkg].packages])
for pkg in package_workspaces
)

Expand Down
5 changes: 1 addition & 4 deletions src/python/pants/backend/javascript/nodejs_project_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ def test_parses_projects(rule_runner: RuleRunner) -> None:
@pytest.mark.parametrize(
("package_manager", "expected_immutable_install_args"),
[
(
None,
("clean-install",),
),
(None, ("clean-install",)),
("npm@10.2.4", ("clean-install",)),
("pnpm@7.5.0", ("install", "--frozen-lockfile")),
("yarn@1.22.19", ("install", "--frozen-lockfile")),
Expand Down
Loading

0 comments on commit fb8e41d

Please sign in to comment.