junitwriter

A junit reporter for node

MIT 8 个版本
安装
npm install junitwriter
yarn add junitwriter
pnpm add junitwriter
bun add junitwriter
README

JUnitWriter

A junit reporter for node.

CI Status

Installation

This package is available on npm as: junitwriter

	npm install junitwriter

API Documentation

Writer

new Writer()

Creates an instance of the junit reporter. When creating an instance a Testsuites root node is created internally which can be accessed through the function getTestsuites().

.getTestsuites()

Returns the Testsuites root node.

.addTestsuite(name)

Adds and returns a testsuite node inside the testsuites root node.

.save(destination, callback)

This function saves the content of the report to a file at the given destination.

Testsuites

.addTestsuite(name)

Adds and returns a Testsuite node inside the Testsuites root node.

.incDisabled(amount)

Increases the disabled test count by the given amount.

.incErrors(amount)

Increases the error count by the given amount.

.incFailures(amount)

Increases the failure count by the given amount.

.incTests(amount)

Increases the test count by the given amount.

.setTime(seconds)

Sets the total execution time in seconds.

.setName(name)

Sets the name attribute.

.setSystemOut(out)

Sets the system-out element with the given output.

.setSystemError(err)

Sets the system-err element with the given error output.

.showIds()

Shows id attributes on all testsuites.

.hideIds()

Hides id attributes on all testsuites.

Testsuite

Testsuite can appear multiple times as a child element of Testsuites.

.addTestcase(name, classname)

Adds and returns a Testcase node with the given name and classname.

.incDisabled(amount)

Increases the disabled test count by the given amount.

.incErrors(amount)

Increases the error count by the given amount.

.incFailures(amount)

Increases the failure count by the given amount.

.incTests(amount)

Increases the test count by the given amount.

.setTime(seconds)

Sets the execution time in seconds.

.setTimestamp(timestamp)

Sets the timestamp attribute with a Date object.

.setName(name)

Sets the name attribute.

.setSystemOut(out)

Sets the system-out element with the given output.

.setSystemError(err)

Sets the system-err element with the given error output.

.setHostname(hostname)

Sets the hostname attribute.

.setPackage(package)

Sets the package attribute.

.setSkipped(skipped)

Marks the testsuite as skipped when true, unmarks when false.

.isSkipped()

Returns whether the testsuite is marked as skipped.

.showId()

Shows the id attribute.

.hideId()

Hides the id attribute.

.addProperty(name, value)

Adds a property with the given name and value.

.removeProperty(name)

Removes the property with the given name.

.updateProperty(name, value)

Updates the property value for the given name.

.addError(message, type)

Adds an error notification with the given message and type.

.addFailure(message, type)

Adds a failure notification with the given message and type.

Testcase

Testcase can appear multiple times as a child element of a Testsuite.

.setName(name)

Sets the name attribute.

.setClassname(classname)

Sets the classname attribute.

.setAssertions(assertions)

Sets the number of assertions.

.setTime(seconds)

Sets the execution time in seconds.

License

LICENSE (MIT)

版本列表
1.0.0 2026-04-10
0.4.1 2019-02-08
0.4.0 2019-01-07
0.3.1 2015-05-29
0.3.0 2015-05-29
0.2.1 2015-03-26
0.2.0 2015-03-26
0.1.0 2015-03-26