3.0.2 • Published 11 months ago

jest-trx-results-processor v3.0.2

Weekly downloads
18,304
License
MIT
Repository
github
Last release
11 months ago

Node.js CI npm version Dependency Status Commitizen friendly semantic-release

jest-trx-results-processor

This package is used to export a TRX file from Jest test runs to be used in Visual Studio and Visual Studio Team Services.

Migration from 0.x

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

Installation

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

Usage

In your jest config add the following entry:

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

You can also pass additional arguments:

{
  "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:

// 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:

{
  "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.

Acknowledgements

This tool is heavily inspired by karma-trx-reporter and jest-junit.

License

jest-trx-results-processor is available under MIT. See LICENSE for more details.

3.0.2

11 months ago

3.0.1

2 years ago

3.0.0

2 years ago

2.2.1

2 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago