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

Is this just a shorter way of doing babel-node tests.js | tape?

Open barneycarroll opened this issue 8 years ago • 8 comments

Perhaps because the name made me think of tape-run, a tool for running tape tests in a browser process, I lazily guessed this might have something to do with bringing the Babel runtime to the browser and compiling the rest, but trial and error tells me I got that wrong :) Going over the README had me wondering what the essence of this package is about - is it a Windows-compatible CLI for what *nix shell would do with babel-node tests.js | tape, or is there something else going on?

barneycarroll avatar Nov 09 '15 21:11 barneycarroll

@barneycarroll its the runner you get with tape (that supports things like globs) with babel registered as to pick up your .babelrc settings and babel modules. i believe it should work with Windows but I haven't tried. runs tests on the command line, no browser support.

wavded avatar Nov 10 '15 02:11 wavded

God knows what Windows users are getting TBH ;P – So this is basically a way of avoiding manually invoking babel and tape as separate strings on the command line?

barneycarroll avatar Nov 10 '15 03:11 barneycarroll

Just ran this on Windows, works the same as on *nix. You can't pipe babel-node into tape bin but it does behave like tape in that is supports globs so I usually do something like this in my package.json

"scripts": {
    "test": "babel-tape-runner \"**/*-test.js\""
},

wavded avatar Nov 10 '15 14:11 wavded

Hi @wavded , is there anyway that I could pipe the test result to another test reporter?

I need something like babel-tape-runner my-test.js | snazzy, currently I could not find it work so I guess pipe is not supported here?

fraserxu avatar Dec 17 '15 05:12 fraserxu

Not sure how you are consuming the output but the TAP is sent through STDOUT so you could pipe if you wanted to work with that output however if anything else writing to STDOUT it probably would break.

wavded avatar Dec 17 '15 16:12 wavded

Yes, sorry about my previous comment. I made some mistakes about the reporter, it works great for me now and thanks for the module!

fraserxu avatar Dec 17 '15 23:12 fraserxu

See https://github.com/wavded/babel-tape-runner/issues/15#issuecomment-210386730

Wilfred avatar Sep 23 '16 18:09 Wilfred

Related question, is this any different from tape -r @babel/register?

Seems a lot simpler than replacing the test-runner itself?

mindplay-dk avatar Dec 15 '19 14:12 mindplay-dk