Skip to content

chore: add test case for pnpm monorepo#8162

Closed
arendjr wants to merge 1 commit intobiomejs:mainfrom
arendjr:pnpm-mono
Closed

chore: add test case for pnpm monorepo#8162
arendjr wants to merge 1 commit intobiomejs:mainfrom
arendjr:pnpm-mono

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Nov 19, 2025

Summary

I was looking into an issue with PNPM symlinks in the past and created a test to try to identify the issue. I don't think I ever managed to reproduce it, but I found the test and figured I might as well push it. Having an extra test can only be a good thing to avoid breaking things in the future.

Test Plan

This PR.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

⚠️ No Changeset found

Latest commit: 4b0df4d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the A-Project Area: project label Nov 19, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

This PR promotes ModuleGraphFsProxy from crate-private to public visibility throughout the module graph crate, making it accessible to external consumers. Alongside this, the PR expands test coverage with new test helpers (insert_node_manifest, get_expression), test fixtures for a pnpm monorepo, and new test cases for type resolution across symlinked dependencies and CORS configurations.

Possibly related PRs

Suggested labels

A-Project, A-Resolver, A-Core, L-JavaScript

Suggested reviewers

  • ematipico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test case for pnpm monorepo, which aligns with the PR's core objective and file changes.
Description check ✅ Passed The description relates to the changeset by explaining the motivation for the test case and acknowledging it's a regression prevention measure, though it could be more specific about test coverage.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
crates/biome_module_graph/src/module_graph/fs_proxy.rs (1)

8-12: Making ModuleGraphFsProxy public matches its new test usage

Exposing this struct is consistent with the new resolver tests and doesn’t change behaviour. Since it’s now part of the public surface, a brief doc comment explaining that it adapts ModuleGraph/ProjectLayout to ResolverFsProxy would be a nice follow‑up.

crates/biome_module_graph/tests/spec_tests.rs (3)

126-142: insert_node_manifest nicely DRYs up manifest handling

Centralising the JSON read + insert logic removes a lot of noisy boilerplate from the tests. If you ever touch this again, you might consider passing package_json_path’s string to deserialize_from_json_str for slightly richer error messages, but it’s not essential for test code.


223-274: Reusing insert_node_manifest in the monorepo fixture test improves clarity

Swapping the inline JSON parsing for calls to insert_node_manifest makes the setup in test_resolve_package_import_in_monorepo_fixtures much easier to scan. If you feel like tidying further, test_resolve_swr_types could be migrated to the same helper for consistency, but that can wait.


2120-2181: pnpm symlink regression test is thorough, but tightly coupled to the store path

This test walks the full pnpm .pnpm path, wires it into ModuleGraphFsProxy::new, and then checks both resolution and the inferred return type of getDocument. That’s a very direct guard against regressions in the resolver. The only mildly brittle bit is the hard-coded store directory name; as long as the committed fixture stays in sync, that’s fine, but if the pnpm lock gets regenerated in future expect to update this string too.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0a02bf and 4b0df4d.

⛔ Files ignored due to path filters (6)
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/node_modules/.pnpm/@typed-firestore+server@2.0.0_firebase-admin@13.4.0_encoding@0.1.13__firebase-functions_8d5bf6c1ffe6eb686c52361f663d4298/node_modules/@typed-firestore/server/dist/documents/get-document.d.ts is excluded by !**/dist/**, !**/node_modules/** and included by **
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/node_modules/.pnpm/@typed-firestore+server@2.0.0_firebase-admin@13.4.0_encoding@0.1.13__firebase-functions_8d5bf6c1ffe6eb686c52361f663d4298/node_modules/@typed-firestore/server/dist/documents/index.d.ts is excluded by !**/dist/**, !**/node_modules/** and included by **
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/node_modules/.pnpm/@typed-firestore+server@2.0.0_firebase-admin@13.4.0_encoding@0.1.13__firebase-functions_8d5bf6c1ffe6eb686c52361f663d4298/node_modules/@typed-firestore/server/dist/index.d.ts is excluded by !**/dist/**, !**/node_modules/** and included by **
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/node_modules/.pnpm/@typed-firestore+server@2.0.0_firebase-admin@13.4.0_encoding@0.1.13__firebase-functions_8d5bf6c1ffe6eb686c52361f663d4298/node_modules/@typed-firestore/server/dist/index.js is excluded by !**/dist/**, !**/node_modules/** and included by **
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/node_modules/.pnpm/@typed-firestore+server@2.0.0_firebase-admin@13.4.0_encoding@0.1.13__firebase-functions_8d5bf6c1ffe6eb686c52361f663d4298/node_modules/@typed-firestore/server/package.json is excluded by !**/node_modules/** and included by **
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/node_modules/@typed-firestore/server is excluded by !**/node_modules/** and included by **
📒 Files selected for processing (7)
  • crates/biome_module_graph/src/js_module_info.rs (1 hunks)
  • crates/biome_module_graph/src/lib.rs (1 hunks)
  • crates/biome_module_graph/src/module_graph.rs (1 hunks)
  • crates/biome_module_graph/src/module_graph/fs_proxy.rs (1 hunks)
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/package.json (1 hunks)
  • crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/src/index.ts (1 hunks)
  • crates/biome_module_graph/tests/spec_tests.rs (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/package.json
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.

Applied to files:

  • crates/biome_module_graph/tests/spec_tests.rs
🧬 Code graph analysis (2)
crates/biome_module_graph/src/lib.rs (1)
crates/biome_js_analyze/src/services/module_graph.rs (1)
  • module_graph (15-17)
crates/biome_module_graph/tests/spec_tests.rs (5)
crates/biome_project_layout/src/project_layout.rs (1)
  • insert_node_manifest (91-120)
crates/biome_module_graph/src/module_graph/fs_proxy.rs (1)
  • new (15-25)
crates/biome_test_utils/src/lib.rs (1)
  • get_added_paths (169-190)
crates/biome_module_graph/src/js_module_info/module_resolver.rs (1)
  • for_module (76-91)
crates/biome_js_syntax/src/file_source.rs (1)
  • ts (179-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_module_graph)
🔇 Additional comments (7)
crates/biome_module_graph/src/js_module_info.rs (1)

173-181: Doc comment now correctly references blanket_reexports

Good catch aligning the documentation with the actual field; this keeps the exports/re‑exports story consistent with the implementation.

crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/src/index.ts (1)

1-1: Import is sufficient to surface getDocument in the module graph

This import gives the tests a named binding to resolve without otherwise changing the fixture’s behaviour, which is exactly what you need here.

crates/biome_module_graph/tests/fixtures/pnpm-mono/services/api/package.json (1)

1-52: Fixture manifest is coherent with the pnpm monorepo setup

The dependency set and the pinned @typed-firestore/server version line up with the paths used in the new pnpm test, so this should be a stable, realistic fixture.

crates/biome_module_graph/src/lib.rs (1)

11-16: Re-exporting ModuleGraphFsProxy keeps the façade consistent

Forwarding ModuleGraphFsProxy from the crate root matches the underlying module’s visibility and simplifies consumer/test imports.

crates/biome_module_graph/src/module_graph.rs (1)

27-27: Public re-export of ModuleGraphFsProxy is in line with the new API

This ties the internal fs proxy module into the public module graph API cleanly and matches the usage from spec_tests.rs.

crates/biome_module_graph/tests/spec_tests.rs (2)

12-25: Additional imports are well-scoped to the new tests

Bringing in the parser, extra AST enums, ModuleGraphFsProxy, and resolver utilities is justified by the new tests and keeps this file self-contained from a test harness point of view.


2195-2302: CORS call-expression test and get_expression helper are focused and robust

Using a tiny in-memory file plus parse and resolved_type_of_expression gives a sharp check that a cors() call is inferred as a function returning void. The get_expression helper does exactly what it says—first top-level expression statement—and the assertion on diagnostics keeps it honest. Looks like a good pattern for future expression-level resolution tests.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 19, 2025

CodSpeed Performance Report

Merging #8162 will not alter performance

Comparing arendjr:pnpm-mono (4b0df4d) with main (e0a02bf)1

Summary

✅ 4 untouched
⏩ 151 skipped2

Footnotes

  1. No successful run was found on main (12d5b42) during the generation of this report, so e0a02bf was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 151 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@arendjr
Copy link
Contributor Author

arendjr commented Nov 19, 2025

Bloody Windows getting in the way again 😓 I'll just close this then.

@arendjr arendjr closed this Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant