avajs / gulp-ava

Run AVA tests
https://ava.li
MIT License
56 stars 17 forks source link

Set reporter programmatically #17

Open 0x1mason opened 7 years ago

0x1mason commented 7 years ago

Possible via options?

0x1mason commented 7 years ago

Custom reporter, e.g. tap-nyan.

sindresorhus commented 7 years ago

From the readme:

Adheres to AVA options in package.json. You can also specify options in the plugin as seen above.

0x1mason commented 7 years ago

@sindresorhus Thanks for the quick response. I read the docs and see the options. I do not see an option for reporters. Does that mean there isn't one?

0x1mason commented 7 years ago

The docs only mention piping to custom reporters via the the cli which is why I'm inquiring here. Is there a gulp specific workaround?

sindresorhus commented 7 years ago

Yeah, you're right. Not that clear. AVA doesn't support third-party reporters directly, but instead comes with a TAP option, enabling you to use any TAP reporter. See the "tap": true, option. Although, thinking about it more, the Gulp output might conflict with the TAP output, so I'm not 100% sure it will work correctly. I think TAP is supposed to ignore non-TAP output, but needs to be confirmed.

That being said. Would honestly be easier to just spawn the ava binary directly from Gulp.

0x1mason commented 7 years ago

Cool, thanks. Yeah, I'll try spawning or hacking the plugin.

sindresorhus commented 7 years ago

Not tested, but with execa it could probably be as simple as:

gulp.task('test', () => execa.shell('ava --tap | tap-nyan', {stdio: 'inherit'}));