remove the dependency patch when the JUnit root-layout fix is released:

Aperta Adatta ai principianti
#694 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
73/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github-actions, javascript, node.js
Ambito
ci-cd, testing

Direzione di ricerca

Inizia da actions/quality/prepare-ci-reports/src/TestReports.js ed esamina la dipendenza junit-to-ctrf e la correzione del layout radice collegata, pull request 93. Verifica se la correzione è stata rilasciata e come viene applicata la patch della dipendenza; rimuovi la patch non appena la release è disponibile. Conferma che il convertitore continui a gestire i report JUnit e produca un report CTRF valido e non vuoto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug need-fix

https://github\.com/ctrf\-io/junit\-to\-ctrf/pull/93

https://github.com/hoverkraft-tech/ci-github-common/blob/3d85e6252a0c3c45c34d6f5d50db140944f61b85/actions/quality/prepare-ci-reports/src/TestReports.js#L4-L5


import fs from "node:fs";
import { validate } from "ctrf";
import { XMLValidator } from "fast-xml-parser";
// FIXME: remove the dependency patch when the JUnit root-layout fix is released:
// https://github.com/ctrf-io/junit-to-ctrf/pull/93
import { convertJUnitToCTRFReport } from "junit-to-ctrf";
import { JestReport } from "./JestReport.js";
import { SourcePaths } from "./SourcePaths.js";

/** Adapt native runner output to the maintained CTRF converters and schema. */
export class TestReports {
	constructor(options) {
		this.options = options;
	}

	async convert(file, target) {
		const options = { ...this.options, output: `${target}.json` };
		const content = fs.readFileSync(file, "utf8");
		let report;
		if (content.trimStart().startsWith("<")) {
			if (
				/<!ENTITY|<!DOCTYPE/i.test(content) ||
				XMLValidator.validate(content) !== true
			)
				throw new Error("Invalid or unsafe JUnit XML.");
			report = await convertJUnitToCTRFReport(file, {
				toolName: options.name,
				log: false,
			});
		} else {
			const value = JSON.parse(content);
			report = value.results
				? value
				: await new JestReport(options).convert(value);
		}
		const result = validate(report);
		if (!result.valid || !report?.results?.tests?.length)
			throw new Error(
				`Expected a nonempty valid test report: ${JSON.stringify(result.errors)}`,
			);
		for (const test of report.results.tests) {
			const source = new SourcePaths(options).resolve(test.filePath);
			if (source) test.filePath = source;
			else delete test.filePath;
		}
		report.results.environment = {
			...report.results.environment,
			appName: options.project,
			buildName: options.name,
		};
		report.results.extra = {
			...report.results.extra,
			variant: options.variant,
		};
		fs.writeFileSync(options.output, JSON.stringify(report));
		return { file: options.output, summary: report.results.summary };
	}
}

Lingua principale
JavaScript
Stelle
5
Fork
1
Merge medio
5h 25m
PR unite (30g)
60

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hoverkraft-tech/ci-github-common

Tutte le issue di hoverkraft-tech/ci-github-common

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.