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

オープン 初心者向け
#694 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
73/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github-actions, javascript, node.js
領域
ci-cd, testing

調査の方向性

actions/quality/prepare-ci-reports/src/TestReports.js から始めて、junit-to-ctrf 依存関係と、リンクされている root-layout の修正(pull request 93)を調べてください。その修正がリリース済みか、依存関係のパッチがどのように適用されているかを確認し、リリースが利用可能になったらパッチを削除してください。コンバーターが引き続き JUnit レポートを処理し、有効で空ではない CTRF レポートを生成することを確認してください。

索引モデルが issue の本文から書いたものです。

説明

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 };
	}
}

主要言語
JavaScript
スター
5
フォーク
1
平均マージ
5時間 25分
マージ済み PR(30日)
60

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hoverkraft-tech/ci-github-common のほかの issue

hoverkraft-tech/ci-github-common の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。