Quickstart
Getting started with @nhtio/japa-junit-reporter is quick and easy. Just follow the steps below and you'll be up and running in no time.
Installation
You can install @nhtio/japa-junit-reporter directly from your preferred package manager
sh
npm i @nhtio/japa-junit-reportersh
pnpm add @nhtio/japa-junit-reportersh
yarn add @nhtio/japa-junit-reporterUsage
Import the
JunitReporterclass from the package:typescriptimport { JunitReporter } from '@nhtio/japa-junit-reporter'Add the
JunitReporterto your Japa config in 3 ways:a. If you have only one reporter, simply use
reporterConfig()typescriptconfigure({ // ...other Japa configuration reporters: JunitReporter.reporterConfig({ reportPath: "foo/bar.xml" }) })b. If you have other reporters, use
listConfig()typescriptconfigure({ // ...other Japa configuration reporters: { activated: [JunitReporter.name], list: [JunitReporter.listConfig({ reportPath: "foo/bar.xml" })], }, })c. If you need access to additional config, feel free to use the native way:
typescriptconfigure({ // ...other Japa configuration reporters: { activated: [JunitReporter.name], list: [ { name: JunitReporter.name, handler: (...args) => new JunitReporter({ reportPath: "foo/bar.xml" }).boot(...args), }, ], }, })Run the tests. When the report will be ready, you will find the report saved at the path you have specified.