avajs/ava

feature request: reporter customization

gibson042 opened this issue · 4 comments

Related to #3160, my CI setup would greatly benefit from having TAP output include parseable test duration (e.g., as requested by TestAnything/Specification#16 ). This is not part of the built-in TapReporter (and appropriately so!), but there's also no way that I can see to apply customization here.

Would you be willing to add a configuration option for this, e.g. --custom-reporter=/path/to/my-custom-reporter.{js,cjs,mjs} and customReporter: class MyCustomReporter { … }? It would require committing to and documenting the API surface area, but AFAICT the { extensions: string[], projectDir: string, reportStream: Writable, stdStream: Writable, watching: boolean } reporter constructor argument shape is simple and seems to be stable, and projectDir at least is already established as such at https://github.com/avajs/ava/blob/main/docs/06-configuration.md#avaconfigjs .

I don't think our current event format is fit for purpose, stable or extensible. But that's what such reporters would be hooking into. See also #2608 and #3004. The latter would probably be the most flexible approach.

@novemberborn What would you think about updating that internal format to conform with https://github.com/js-reporters/js-reporters?

That project looks abandoned… and at first glance, what AVA needs is an interchange format we'd emit to stdout so you can pipe to other tools. We wouldn't necessarily want to load third-party code into the main process.

Acknowledged. We'll continue local patching for our purposes until such an interface is available.