# jest-trx-results-processor

> Jest results processor for exporting into TRX files for Visual Studio

Latest version **3.0.2** (published 2023-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-trx-results-processor
pnpm add jest-trx-results-processor
yarn add jest-trx-results-processor
bun add jest-trx-results-processor
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-06-08 |
| First published | 2016-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 63.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Dan Homola |
| Maintainers | no23reason |
| Keywords | jest, jestjs, jest-cli, trx |

## Links

- npm: https://www.npmjs.com/package/jest-trx-results-processor
- Repository: https://github.com/no23reason/jest-trx-results-processor
- Homepage: https://github.com/no23reason/jest-trx-results-processor#readme
- Issues: https://github.com/no23reason/jest-trx-results-processor/issues
- npm.io page: https://npm.io/package/jest-trx-results-processor

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^8.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.3
- [xmlbuilder](https://npm.io/package/xmlbuilder.md) ^15.1.0

## Recent versions

- 3.0.2 (latest) — 2023-06-08
- 3.0.1 — 2022-06-14
- 3.0.0 — 2022-04-12
- 2.2.1 — 2022-02-08
- 2.2.0 — 2020-09-17
- 2.1.0 — 2020-08-27
- 2.0.3 — 2020-05-05
- 2.0.2 — 2020-05-02
- 2.0.1 — 2020-05-02
- 2.0.0 — 2020-02-25
- 1.0.3 — 2019-11-30
- 1.0.2 — 2019-10-03
- 1.0.1 — 2019-09-23
- 1.0.0 — 2019-08-31
- 0.2.0 — 2019-08-30
- … 8 more at https://npm.io/package/jest-trx-results-processor/versions

## README

![Node.js CI](https://github.com/no23reason/jest-trx-results-processor/workflows/Node.js%20CI/badge.svg)
[![npm version](https://img.shields.io/npm/v/jest-trx-results-processor.svg)](https://www.npmjs.com/package/jest-trx-results-processor)
[![Dependency Status](https://david-dm.org/no23reason/jest-trx-results-processor.svg)](https://david-dm.org/no23reason/jest-trx-results-processor)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

# jest-trx-results-processor

This package is used to export a TRX file from [Jest](https://facebook.github.io/jest/) test runs to be used in [Visual Studio](https://www.visualstudio.com/) and [Visual Studio Team Services](https://www.visualstudio.com/vsts-test/).

## Migration from 0.x

Version 1.0.0 was rewritten to use reporters API. Either use that (see [Usage](#usage)), or update the require path in your configuration (see [Usage as testResultsProcessor](#usage-as-testresultsprocessor)).

## Installation

```
yarn add --dev jest-trx-results-processor
```

## Usage

In your jest config add the following entry:

```json
{
  "reporters": ["default", "jest-trx-results-processor"]
}
```

You can also pass additional arguments:

```json
{
  "reporters": [
    "default",
    [
      "jest-trx-results-processor",
      {
        "outputFile": "relative/path/to/resulting.trx", // defaults to "test-results.trx"
        "defaultUserName": "user name to use if automatic detection fails" // defaults to "anonymous"
      }
    ]
  ]
}
```

Then run jest as usual.

## Usage as testResultsProcessor

_Notice: this method of use will be removed in the next major version. Please use the reporters API described above._

Create a `jestTrxProcessor.js` file somewhere in your project (for this example I'll assume the `scripts` folder).
There you can configure the processor, as Jest does not allow you to pass custom parameters to the results processor:

```js
// for jest-trx-results-processor >= 1.0.0
var builder = require("jest-trx-results-processor/dist/testResultsProcessor"); // only this has changed since v 0.x
// for jest-trx-results-processor < 1.0.0
var builder = require("jest-trx-results-processor");

var processor = builder({
  outputFile: "relative/path/to/resulting.trx", // this defaults to "test-results.trx"
  defaultUserName: "user name to use if automatic detection fails", // this defaults to "anonymous"
});

module.exports = processor;
```

Finally, point Jest to your results processor in the `package.json`:

```json
{
  "devDependencies": {
    "jest": "^19.0.0",
    "jest-trx-results-processor": "~0.0.5"
  },
  "jest": {
    "testResultsProcessor": "./scripts/jestTrxProcessor"
  }
}
```

Then you just run Jest as you normally would.

Minimal working configuration can be seen in the [examples folder](https://github.com/no23reason/jest-trx-results-processor/tree/master/examples).

## Acknowledgements

This tool is heavily inspired by [karma-trx-reporter](https://github.com/hatchteam/karma-trx-reporter) and [jest-junit](https://github.com/jest-community/jest-junit).

## License

_jest-trx-results-processor_ is available under MIT. See [LICENSE](https://github.com/no23reason/jest-trx-results-processor/tree/master/LICENSE) for more details.

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