tape-testing / tape-run

Headless tape test runner
223 stars 23 forks source link

Option to keep the browser open for debugging #55

Closed RCasatta closed 7 years ago

RCasatta commented 7 years ago

After running: browserify test.js | tape-run -b chrome | faucet I have some failed test, I think could be interesting to have an option to keep the process active and the browser open to use the browser debugging tools to investigate the error, something like browserify test.js | tape-run -b chrome --keepopen | faucet

juliangruber commented 7 years ago

sounds useful to me, and only would need not to call this: https://github.com/juliangruber/tape-run/blob/master/index.js#L17

do you want to make a pull request for this? and maybe let's rename the cli flag, like --keep-open

RCasatta commented 7 years ago

I made this https://github.com/juliangruber/tape-run/pull/56 but I am sorry I have some problems with child-kill module inside the tape-run project so I did not properly test the commit

RCasatta commented 7 years ago

it works and the browser doesn't close. The problem is that I cannot put a breakpoint and refresh the page cause the process serving the page from localhost is finished. Is it possible to keep the server open until the browser is open?

juliangruber commented 7 years ago

looking at the code, the server should stay open actually. can you look into this further? eg find out where the process exits?

RCasatta commented 7 years ago

I cannot figure out where the process exits. But you can emulate it by running browserify test.js | tape-run where test.js is:

var test = require('tape');

test('a', function (t) {
  t.true(true);
  t.end();
});

I noticed that you can emulate the desired behaviour by adding at the end of browserify a test which does not call test.end() eg: browserify test/*.js test/debug/test-with-no-end.js | tape-run -b chrome