Skip to content

Keep run.sh short and split tests into engine and CLI to close #778 - #779

Merged
mathiasrw merged 17 commits into
mainfrom
fix/778
Oct 23, 2026
Merged

mathiasrw merged 17 commits into
mainfrom
fix/778

Conversation

@mathiasrw

@mathiasrw mathiasrw commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Closes #778

Related to #717 and #734.

Change

  • test/cli/run.sh is a short demo: a few examples for each feature, and a combination where it helps. 68 asserts, down from about 200.
  • The checks of many combinations moved to test/cli/<feature>.test.js. They run the CLI with Bun's shell, so a test reads like the command: sh($`echo -n x | bun ${cli} o x my.file --pipe`) gives {out, err, exit}. Files are made and read with Bun.write and Bun.file.
  • The engine tests moved from test/js to test/engine. The CLI parts of them moved to test/cli.
  • test/helper.js is shared by both, and has cli and sh() in place of the old cli().
  • The demo runs two times, down from five plus the global script: the installed rexreplace with Node, and the installed rexreplace-bun with Bun. Each run checks that the commands are the right build (+bun or not).
  • Help, version, -v and -h alone, and the --bail alias are only in run.sh.
  • test/cli/global.run.node.sh is gone.
  • README and devguide describe the four groups of tests: demo, CLI, engine and fuzzy.

Good to know

  • Bun's shell turns non-ASCII text written in the command into \u escapes, so a value with €, § or an emoji is given as ${'…'}.
  • When yargs stops a run on its own checks (like two flags that conflict), it prints an empty line to stdout. The tests check the error, the exit code and that the file is unchanged, not that stdout is empty.

Tests

yarn test-ci passes: the demo on Node and Bun, and 908 Bun tests.

# Conflicts:
#	test/cli/run.sh
#	test/engine/fix/711.test.js
#	test/engine/utf8.test.js
@mathiasrw
mathiasrw changed the base branch from fix/735 to main October 23, 2026 02:39
@mathiasrw
mathiasrw merged commit 6ea7b83 into main Oct 23, 2026
7 checks passed
@mathiasrw
mathiasrw deleted the fix/778 branch October 23, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep run.sh as a short demo, and split the tests into engine and CLI

1 participant