test(exec): fix Windows failure in PnP require option test#12499
Conversation
The 'exec should merge node options with PnP require option' test (added in #12430) hardcoded an unquoted '--require=<path>' expectation. On Windows the .pnp.cjs path contains backslashes, which makeNodeRequireOption quotes and escapes for Node's NODE_OPTIONS tokenizer, so the assertion mismatched and the test failed on Windows runners. Derive the expected NODE_OPTIONS from makeNodeRequireOption itself so the expectation matches the implementation's quoting on every platform.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix Windows CI failure in exec PnP NODE_OPTIONS merge test Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require review
Previous review resultsReview updated until commit d35e967 Results up to commit d35e967
Great, no issues found!Qodo reviewed your code and found no material issues that require review
|
|
Code review by qodo was updated up to the latest commit d35e967 |
Summary
The
exec should merge node options with PnP require optiontest (added in #12430) is failing on the Windows CI runners onmain, e.g. run 27752731292 (TS CI / Test / windows / Node 26).The test hardcodes an unquoted expectation:
NODE_OPTIONS: `--max-old-space-size=4096 --require=${pnpPath}`But #12430 made
makeNodeRequireOptionrun the path throughquotePathIfNeeded. On Windows the.pnp.cjspath contains backslashes, which match/[\s"'\\]/, so the path is wrapped in double quotes and backslash-escaped (--require="D:\\a\\...\\.pnp.cjs") for Node'sNODE_OPTIONStokenizer. The quoting is intentional and correct — only the test's expectation was wrong. On POSIX the path has no special characters, so it's left unquoted and the test happened to pass there.Fix
Derive the expected
NODE_OPTIONSfrommakeNodeRequireOptionitself (the source of truth) instead of hardcoding the unquoted form, so the expectation matches the implementation's quoting on every platform. The test still guards the original regression (nodeOptionsbeing dropped when the PnP require option is added): ifexec.handlerdropped--max-old-space-size=4096, the produced value would no longer equal the helper's output.This is a test-only change — no published package behavior changes, so no changeset.
Test plan
pnpm --filter @pnpm/exec.commands run compiletest/exec.tspasses locally (4/4) on macOS.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit