yahoo / preceptor

Test runner and aggregator
http://yahoo.github.io/preceptor/
MIT License
85 stars 7 forks source link

Cucumber and Mocha - ES2015 transpiler #3

Open srhwork opened 8 years ago

srhwork commented 8 years ago

Hi.

I'm developing a project where I use "cucumber" for functional testing and "mocha" for unit testing. So I want to use "preceptor" to manage both test frameworks.

The problem is that all my tests use ES2015 syntax, so I use the "--compiler" and "--compilers" option in "cucumber" and "mocha" to run.

./node_modules/.bin/cucumber.js --compiler js:babel/register test/features

or

./node_modules/.bin/babel-node ./node_modules/.bin/cucumber.js test/features

and

./node_modules/.bin/mocha --compilers js:babel/register --recursive ./test/unit/

Is possible to add the compile option to tasks in "preceptor"?

Thanks.

marcelerz commented 8 years ago

I can add this feature. Will have to see how and when I will be able to add this. I added it to the milestone.

However, you could use this already today by running a shell task and loading the results afterwards with a loader task. See the documentation (readme) for some examples. Let me know if this is not enough to get you setup.

ricky commented 8 years ago

Another work-around is to require your compiler in a separate file, e.g.:

// mocha-compiler.js
require('babel/register');

And require require the file in your preceptor config, e.g.

{
    "type": "mocha",
    "title": "My Test",
    "configuration": {
        "require": [ "/path/to/mocha-compiler.js" ]
    }
}