This package is used to export a TRX file from Vitest test runs to be used in Visual Studio and Visual Studio Team Services.
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).
yarn add --dev vitest-trx-results-processor
In your jest config add the following entry:
{
"reporters": ["default", "vitest-trx-results-processor"]
}
You can also pass additional arguments:
{
"reporters": [
"default",
[
"vitest-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 vitest as usual.
Notice: this method of use will be removed in the next major version. Please use the reporters API described above.
Create a vitestTrxProcessor.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 vitest-trx-results-processor >= 1.0.0
var builder = require("vitest-trx-results-processor/dist/testResultsProcessor"); // only this has changed since v 0.x
// for vitest-trx-results-processor < 1.0.0
var builder = require("vitest-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 Vitest to your results processor in the package.json
:
{
"devDependencies": {
"vitest": "^3.0.5",
"vitest-trx-results-processor": "~0.0.5"
},
"jest": {
"testResultsProcessor": "./scripts/vitestTrxProcessor"
}
}
Then you just run Vitest as you normally would.
Minimal working configuration can be seen in the examples folder.
This tool is a fork from jest-trx-results-reporter which is heavily inspired by karma-trx-reporter and jest-junit.
vitest-trx-results-processor is available under MIT. See LICENSE for more details.