# junitwriter

> A junit reporter for node

Latest version **1.0.0** (published 2026-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install junitwriter
pnpm add junitwriter
yarn add junitwriter
bun add junitwriter
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2026-04-10 |
| First published | 2015-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 4 |
| Unpacked size | 57.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Norman Rusch |
| Maintainers | nrmnrsh |
| Keywords | junit, reporter, filewriter, tests, jenkins, xml |

## Links

- npm: https://www.npmjs.com/package/junitwriter
- Repository: https://github.com/schorfES/node-junitwriter
- Homepage: https://github.com/schorfES/node-junitwriter#readme
- Issues: https://github.com/schorfES/node-junitwriter/issues
- npm.io page: https://npm.io/package/junitwriter

## Dependencies (4)

- [merge](https://npm.io/package/merge.md) ^2.1.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [dateformat](https://npm.io/package/dateformat.md) ^3.0.3
- [xmlbuilder](https://npm.io/package/xmlbuilder.md) ^15.1.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 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

## README

# JUnitWriter

A junit reporter for node.

[![CI Status](https://github.com/schorfES/node-junitwriter/actions/workflows/ci.yml/badge.svg)](https://github.com/schorfES/node-junitwriter/actions)

## Installation

This package is available on [npm](https://www.npmjs.com/package/junitwriter/)
as: `junitwriter`

``` sh
	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)](https://github.com/schorfES/node-junitwriter/blob/master/LICENSE)

---
_Source: https://npm.io/package/junitwriter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
