5.1.1 • Published 9 months ago

junit-report-builder v5.1.1

Weekly downloads
405,160
License
MIT
Repository
github
Last release
9 months ago

junit-report-builder

Build Status Weekly Downloads

A project aimed at making it easier to build Jenkins compatible XML based JUnit reports.

Installation

To install the latest version, run:

npm install junit-report-builder --save

Usage

import builder from 'junit-report-builder';

// Create a test suite
let suite = builder.testSuite().name('My suite');

// Create a test case
let firstTestCase = suite.testCase()
  .className('my.test.Class')
  .name('My first test');

// Create another test case which is marked as failed
let secondTestCase = suite.testCase()
  .className('my.test.Class')
  .name('My second test')
  .failure();

builder.writeTo('test-report.xml');

This will create test-report.xml containing the following:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" failures="1" errors="0" skipped="0">
  <testsuite name="My suite" tests="2" failures="1" errors="0" skipped="0">
    <testcase classname="my.test.Class" name="My first test"/>
    <testcase classname="my.test.Class" name="My second test">
      <failure/>
    </testcase>
  </testsuite>
</testsuites>

If you want to create another report file, start by getting a new builder instance like this:

// Each builder produces a single report file
let anotherBuilder = builder.newBuilder();

CommonJS is also supported:

let builder = require('junit-report-builder');

Please refer to the e2e.spec.ts for more details on the usage.

License

MIT

Changelog

5.1.1

  • Change markdown-doctest from a dependency to a dev dependency.

5.1.0

  • Add support for multiline properties, where the value is stored as text content instead of in the value attribute. Thanks to Sebastian Sauer.

5.0.0

  • A re-release of 4.0.1 since that version broke the CommonJS API.
  • Remove an internal type from the public API.

4.0.1 (deprecated)

  • Deprecated, since the CommonJS API was accidentally changed in 4.0.1. Re-released as 5.0.0.
  • Re-introduce CommonJS support, while keeping the ES module support. Thanks to Harel Mazor and Simeon Cheeseman.
  • Export all public types from index.d.ts. Thanks to Harel Mazor and Simeon Cheeseman.
  • Full typing support for TypeScript. Thanks to Harel Mazor.

4.0.0 (deprecated)

  • Deprecated, since the CommonJS support was accidentally dropped. This is fixed again in 4.0.1.
  • Dropped support for node.js 14, 12, 10 and 8.
  • Full typing support for TypeScript. Thanks to Harel Mazor.

3.2.1

  • Update documentation.

3.2.0

  • Support name and test count attributes for the root test suites element. Thanks to Simeon Cheeseman.
  • Describe parameter types and return types with JSDoc. Thanks to Simeon Cheeseman.

3.1.0

  • Add support for generic properties for test cases. Thanks to Pietro Ferrulli.
  • Bump dependencies

3.0.1

  • Bump dependencies: lodash, make-dir, date-format, minimist

3.0.0

  • Properly prevent invalid characters from being included in the XML files.
  • Dropped support for node.js 4 and 6

2.1.0

  • Added support for adding a file attribute to a test case. Thanks to Ben Holland.

2.0.0

  • Replace mkdirp by make-dir to resolve npm advisory 1179.
  • Dropped support for node.js 0.10.x and 0.12.x

1.3.3

  • Updated lodash to a version without known vulnerabilities.

1.3.2

  • Added support for emitting the type attribute for error and failure elements of test cases
  • Added support for emitting cdata/content for the error element of a test case

Thanks to Robert Turner.

1.3.1

  • Update dependencies to versions without known vulnerabilities.

1.3.0

1.2.0

  • Support creating XML with emojis. Thanks to ischwarz.

1.1.1

  • Changed date-format to be a dependency. Previously it was incorrectly set to be a devDependency. Thanks to georgecrawford.

1.1.0

  • Added attributes for test count, failure count, error count and skipped test count to testsuite elements
  • Added ability to attach standard output and standard error logs to test cases
  • Added ability set execution time for test suites
  • Added ability set timestamp for test suites

1.0.0

  • Simplified API by making the index module export a builder instance

0.0.2

  • Corrected example in readme

0.0.1

  • Initial release
@bhi-studios/audit-depedencies@leni-msft/oav@everything-registry/sub-chunk-1994tastee-corespellchecker-clivizvizard@digitaslbiparis/sitespeed.iojasdriverkignuf-wdio-junit-reporterjunit-barkdfeuk-frontenddfeuk-frontend-manual@applitools/preflight-cli@adobe/cci-test-aggregator@bhi-studios/audit-dependencies@cloudbeat/cliwdio-bitb-reporterwdio-browserstack-reporterwdio-junit-file-reporterwdio-junit-morganchristiansson-reporterwdio-junit-reporterwdio-junit-reporter-morganchristianssonwebdriverio-browserstack-reporter@finos/calm-cli@ianwalter/bff@eki-group/svelvet@gpittarelli/wdio-junit-reporter@georgecrawfordft/wdio-junit-reporter@mourasman/cucumber-junit-convert@nncdevel-io/cspell-junit-reporter@postman/wdio-junit-reporter@ruowan-test/oav@proof-ui/junit-plugin@onhand/tsting@openstapps/api-climomenticpa11y-reporter-junitoxygen-clioavroc-plugin-test-webdriveriosanity-runner-clientsarif-junitprotractor-browserstack-reporterscriptworks-vitaq-clientscriptworks-clientnewman-test-runnernetsparkerscanrunnerreplicated-lintpuppetarazzisfdysitespeed.webscannersitespeedgrunt-axe-webdrivergrunt-axe-webdriver-customscriptsgrunt-axe-webdriver2grunt-newman-junit-reportergulp-reporterhornet-js-codeceptjshtmlacademy-backstopjsmarkdownlint-cli2-formatter-junitlambdaguardjunit@wdio/junit-reporter@tablecheck/commitlint-config@teambit/tester@thekla/cucumber-junit-formatter@testingrequired/testframe@testingrequired/tf@thing-description-playground/cli@thing-description-playground/core@valentin.condurache/wdio-junit-reporter@zalastax/nolb-jun@zhenglaizhang/oava11y-junit-reporteraxe-playwrightanypoint-cli-api-project-librarybackstopjs-dockerbackstopjs-playwrightbackstopjs-spectrumbackstopjs-testbackstopjsassertible-to-junitbackstop-byobbackstop-playwrightcommit-watchcloudbeat-clicreate-junit-reportcontractpolicecucumberjs-nice-junitcucumberjs2-nice-junitcucumber-to-junitcucumber-junit-convertcucumber-junit-reporterdepcheck-junitbatpadjsdockerfile_lintdownstream_dgrebb_backstopjsenqueuer-plugin-xunit-reportgemini-xml-reporter@sf-explorer/devops.cli
5.1.1

9 months ago

5.1.0

9 months ago

4.0.1-rc.0

11 months ago

5.0.0

11 months ago

4.0.1

11 months ago

4.0.0

11 months ago

3.2.1

1 year ago

3.2.0

1 year ago

3.1.0

2 years ago

3.0.1

3 years ago

3.0.0

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

8 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago