babel-tape-runner icon indicating copy to clipboard operation
babel-tape-runner copied to clipboard

Watching

Open raine opened this issue 8 years ago • 9 comments

I understand it may not exactly be in the scope of this project but I'm wondering if there's any way to make babel-tape-runner a long running process similarly to mocha's -w.

I'm more concerned about minimizing the slow startup time (because of babel overhead) than watching files for changes.

raine avatar Oct 29 '15 21:10 raine

Watching can be easily accomplished with npm-watch but what I like about mocha -w is that it makes test feedback instantaneous, probably because it doesn't spin up a new process and require stuff every time files change.

raine avatar Oct 30 '15 09:10 raine

I don't have any plans on supporting watching. A quick look around GH didn't turn up any tape runners with watching built in, have you found any?

wavded avatar Oct 30 '15 18:10 wavded

That'd be a neat feature! I'm using watch to do that, in a personal project: https://github.com/nicolaspayot/gym-tracker/blob/master/api/package.json#L12

nicolaspayot avatar Nov 03 '15 13:11 nicolaspayot

I tried and failed in every possible way, I could think of -m - wasted well over two weeks now. I couldn't remove and re-require the test files. It just kept add them on the stack instead. Hope someone implement this - assuming this might increase tape's speed closer to mocha.

dacodekid avatar Nov 18 '15 03:11 dacodekid

tape-watch keeps a long-running process, but doesn't seem to support transpilers at the moment.

r-k-b avatar Apr 03 '16 00:04 r-k-b

That pretty much lets me get back to mocha/chai. With a huge codebase you want instant test feedback and that can only be achieved by watching for changes.

pke avatar Jul 19 '16 10:07 pke

FYI: tape-watch supports the require flag now so you can use things like babel with it

https://github.com/rstacruz/tape-watch#using-with-babel

wavded avatar Jul 19 '16 15:07 wavded

Here's an example of using tape-watch instead of babel-tape-runner, from my package.json:

  "scripts": {
    "test": "babel-tape-runner static/__tests__/* | tap-diff",
    "test-watch": "tape-watch -r babel-register static/__tests__/* -o '| ./node_modules/tap-diff/distributions/cli.js'",

Wilfred avatar Aug 17 '16 21:08 Wilfred

Please notice that if you are using tape-watch with @babel/register the line should start with:

tape-watch -r @babel/register ...

Kind of obvious when you know it, but took me a while to figure out.

brunoreis avatar Dec 27 '18 18:12 brunoreis