test: address test failures by increasing maxBuffer limit#13265
Merged
Conversation
The job "Run affected tests" in workflow `run_affected_tests` failed on
develop with `stdout maxBuffer length exceeded` while running
`lib/node_modules/@stdlib/namespace/test/test.cli.js:238`.
Root cause: two tests exec the namespace CLI and capture its full
stdout (a CSV dump and a newline-delimited JSON dump of all 3212+
namespace entries) via `child_process.exec` without an explicit
`maxBuffer`, so Node's 1 MiB default applies. The namespace has grown
past that limit, so `exec` now returns an error instead of stdout,
which fails the test via `t.fail(error.message)`. The failure is
deterministic and reproduces on every run, as the namespace only
grows.
This commit adds an explicit `maxBuffer` option (`5000*1024`) to both
`exec` calls, matching the existing `{'maxBuffer': N*1024}` convention
used in `lib/node_modules/@stdlib/datasets/*/test/test.cli.js` for
CLIs with large stdout. No source or CLI behavior changes.
Ref: https://github.com/stdlib-js/stdlib/actions/runs/28686663068
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
Jul 4, 2026
maxBuffer in test.cli.jsmaxBuffer limit
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.
Description
This pull request:
stdout maxBuffer length exceededfailures inlib/node_modules/@stdlib/namespace/test/test.cli.js, which fail everyrun_affected_tests/run_tests_coveragerun that touches the namespace package.Failing run: https://github.com/stdlib-js/stdlib/actions/runs/28686663068
Symptom:
Root cause: Two tests in
test.cli.jsexec()the namespace CLI and capture its full stdout — one as CSV (--fields alias,path), one as newline-delimited JSON (all fields, includingrelatedarrays) — usingchild_process.execwith no explicitmaxBuffer, so Node's 1 MiB default applies. The stdlib namespace has grown to 3212+ entries, and the full JSON dump now exceeds that default, soexec()passes anerrorto its callback instead ofstdout, which fails the test viat.fail(error.message). This is deterministic and will fail on every run going forward, not intermittent.Fix: Add an explicit
maxBufferoption (5000*1024, ~4.9 MiB) to bothexec()calls that dump the full namespace. This matches the pre-existing{'maxBuffer': N*1024}convention already used acrosslib/node_modules/@stdlib/datasets/*/test/test.cli.js(e.g.moby-dick,cmudict,sotu) for CLI tests with large stdout. The other fourexec()calls in the same file (--help,-h,--version,-V) produce trivial stderr-only output and were left unchanged. No source or CLI behavior changes — test-only.Related Issues
None.
Questions
No.
Other
Validation: Three independent automated reviews (correctness, regression scope, style/conventions) all returned
approvewith no blocking findings.exec()calls are patched, confirmed the other four are trivial and don't need it, and estimated ~5x headroom over current output size (namespace would need to nearly quintuple before recurring).maxBufferdoes not mask a correctness bug (both tests still assert stdout content against a locally computed expected value), confirmed no source/CLI/CI files were touched.N*1024numeric-literal style all match the established sibling convention indatasets/*/test.cli.js, and that the localoptsshadowing of the outer tapeskipoptions mirrors the same pattern already used in those files.Reviewer notes: All three reviewers independently flagged the same non-blocking style nit: the new local
var opts(holding{maxBuffer}) shadows the outer, module-scopevar opts(holding tape's{skip}option) within each test callback. This is intentional, harmless (the outeroptsis already resolved as tape's second argument before the callback body runs), and is the identical pattern already used inlib/node_modules/@stdlib/datasets/moby-dick/test/test.cli.jsand.../cmudict/test/test.cli.js, so no change was made.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was prepared by an automated CI-failure investigation routine (Claude Code). The root cause was identified by reading the failing job logs and namespace source, the fix was implemented to match an existing repo-wide convention, and it was validated by three independent automated reviews (correctness, regression scope, style) before opening this PR.
@stdlib-js/reviewers
Generated by Claude Code