How to use the junit-report-builder.newBuilder function in junit-report-builder

To help you get started, we’ve selected a few junit-report-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github replicatedhq / replicated-lint / src / cmdutil / reporters.ts View on Github external
export function junitReporter(__: string, rulesUsed: linter.YAMLRule[], results: linter.RuleTrigger[], outputDir: string) {
  const reportBuilder = junitReports.newBuilder();
  const suite = reportBuilder.testSuite().name("replicated-lint");

  const invalidYAMLError = getInvalidYAMLError(results);

  for (const rule of rulesUsed) {
    const testCase = suite.testCase().className("replicated-lint").name(rule.name);

    if (invalidYAMLError) { // if the yaml was invalid, then all the rules should fail regardless of results
      testCase.failure(invalidYAMLError.message);
      continue;
    }

    const result = _.find(results, r => r.rule === rule.name);
    if (result) {
      testCase.failure(result.message);
    }
github webdriverio-boneyard / wdio-junit-reporter / lib / reporter.js View on Github external
prepareXml (runners) {
        const builder = junit.newBuilder()
        for (const key of Object.keys(runners)) {
            const capabilities = runners[key]
            const packageName = this.options.packageName
                ? `${capabilities.sanitizedCapabilities}-${this.options.packageName}`
                : capabilities.sanitizedCapabilities

            for (let specId of Object.keys(capabilities.specs)) {
                const spec = capabilities.specs[specId]

                for (let suiteKey of Object.keys(spec.suites)) {
                    /**
                     * ignore root before all
                     */
                    /* istanbul ignore if  */
                    if (suiteKey.match(/^"before all"/)) {
                        continue
github gucong3000 / gulp-reporter / lib / ci-reporter.js View on Github external
function junit (errors) {
	const builder = reportBuilder.newBuilder();
	Object.keys(errors).forEach(fileName => {
		const suite = builder.testSuite().name(fileName);
		errors[fileName].forEach(error => {
			const testCase = suite.testCase()
				.name(`${icons[error.severity] || icons.success} ${error.message}`)
				.className([error.plugin, error.rule].filter(Boolean).join(' '));
			const message = `${error.fileName}:${error.lineNumber}:${error.columnNumber}`;
			if (!error.severity || error.severity === 'error') {
				testCase.error(message);
			} else {
				testCase.failure(message);
			}
		});
	});

	return fs.outputFile(reportPath(String(Date.now()), 'lint-result.xml'), builder.build());
github adobe / helix-cli / src / junit-utils.js View on Github external
constructor() {
    this._outfile = path.resolve(process.cwd(), 'test-results.xml');
    this._builder = builder.newBuilder();
  }
github intuit / proof / plugins / junit / src / main.ts View on Github external
proof.hooks.end.tapPromise('junit', async (results: SuiteResult) => {
      const reportBuilder = newBuilder();
      results.tests.forEach(t => {
        if (!suites.has(t.story.kind)) {
          suites.set(
            t.story.kind,
            reportBuilder.testSuite().name(t.story.kind)
          );
        }

        const suite = suites.get(t.story.kind);
        if (!suite) {
          return;
        }

        const testCase = suite.testCase().name(t.name);
        if (t.error) {
          testCase.failure(t.error.message);

junit-report-builder

Aimed at making it easier to build Jenkins compatible JUnit XML reports in plugins for testing frameworks

MIT
Latest version published 3 months ago

Package Health Score

74 / 100
Full package analysis