To test
✓ Published0🌍 Public
HHypercubed
Last edited Jun 6, 2016
Created on Jun 6, 2016
This example demonstrates how the tap-summary tool alters the exit code behavior of a Node.js test script, showing that piping test output through it suppresses the original error signal. The code runs a tape test that intentionally throws an uncaught error inside a callback, then compares the exit codes from three shell invocations: direct execution, piping through tap-summary, and piping through a modified `bin/cmd.js`. The direct run returns exit code 1, the tap-summary pipe returns 0, and the modified command restores the expected error code 1. The example uses Node.js’s `child_process` via shell commands and the tape testing framework.
AI-generated descriptionTo test
$ node ./example/test-error.js
$ echo $? # prints 1, an error
1
$ node ./example/test-error.js | tap-summary
$ echo $? # prints 0, no error
0
$ node ./example/test-error.js | ./bin/cmd.js # as modified in PR
$ echo $? # prints 1, an error
1