Skip to content

Commit

Permalink
feat: in keep-open mode, forward test result to ctrl-c exit
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Jun 16, 2019
1 parent 9ed7206 commit 9a56224
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# browser-do

Alternative implementation of [browser-run](https://github.com/juliangruber/browser-run) and [tape-run](https://github.com/juliangruber/tape-run), with better Windows support.
Alternative implementation of [browser-run](https://github.com/juliangruber/browser-run) and [tape-run](https://github.com/juliangruber/tape-run), with better Windows support, plus [mocha](https://mochajs.org), [jasmine](https://jasmine.github.io), [tape](https://github.com/substack/tape) support out of the box.

browser-do offers

1. browser launcher implementation borrowed from various karma browser launchers. Simpler and more reliable on Windows.
2. [TAP output](https://en.wikipedia.org/wiki/Test_Anything_Protocol) support in one package.
2. [TAP output](https://en.wikipedia.org/wiki/Test_Anything_Protocol) support.

## Usage

TODO keep opts same as much as possible, add one option (or make it default) for TAP output.
## Supported Browsers


### Supported Browsers
electron is the always available default.

| | macOS | Linux | Windows |
|--------------------|-------|-------|---------|
Expand All @@ -26,3 +23,8 @@ TODO keep opts same as much as possible, add one option (or make it default) for
| firefox-headless | Yes | Yes | Yes |
| ie | | | Yes |
| safari | Yes | | |

## Usage

TODO keep opts same as much as possible, add one option (or make it default) for TAP output.

6 changes: 5 additions & 1 deletion bin/browser-do.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const readInput = new Writable({

process.stdin.pipe(readInput);

let failed = false;

readInput.on('finish', () => {
const data = Buffer.concat(chunks).toString();
const holdOutput = through();
Expand All @@ -52,6 +54,8 @@ readInput.on('finish', () => {
// 1. tap-parser to deal with tap results
if (tap) {
tapParse(holdOutput, (err, passed) => {
failed = !passed;

if (err) {
console.error(err.message);
}
Expand All @@ -70,6 +74,6 @@ readInput.on('finish', () => {

process.on('SIGINT', () => {
// manually call process.exit() so it will trigger 'exit' event.
process.exit();
process.exit(failed ? 1 : 0);
});
});

0 comments on commit 9a56224

Please sign in to comment.