Merge pull request #319020 from pluiedev/init/xunit-viewer

xunit-viewer: init at 10.6.1
This commit is contained in:
Robert Hensing 2024-06-16 16:27:18 +02:00 committed by GitHub
commit a94dfb6e0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,42 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
nix-update-script,
callPackage,
testers, xunit-viewer,
}:
let
version = "10.6.1";
in
buildNpmPackage {
pname = "xunit-viewer";
inherit version;
src = fetchFromGitHub {
owner = "lukejpreston";
repo = "xunit-viewer";
rev = "v${version}";
hash = "sha256-n9k1Z/wofExG6k/BxtkU8M+Lo3XdCgCh8VFj9jcwL1Q=";
};
npmDepsHash = "sha256-6PV0+G1gzUWUjOfwRtVeALVFFiwkCAB33yB9W0PCGfc=";
passthru.updateScript = nix-update-script { };
passthru.tests = {
version = testers.testVersion {
package = xunit-viewer;
version = "unknown"; # broken, but at least it runs
};
example = callPackage ./test/example.nix { };
};
meta = {
description = "View your xunit results using JavaScript";
homepage = "https://lukejpreston.github.io/xunit-viewer";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [ pluiedev ];
platforms = lib.platforms.all;
};
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- taken from the nix test suite and then stripped down -->
<testsuites tests="280" failures="0" disabled="2" errors="0" time="0.2" timestamp="2024-06-16T13:50:02.511" name="AllTests">
<testsuite name="parseShebangContent" tests="14" failures="0" disabled="0" skipped="0" errors="0" time="0.001" timestamp="2024-06-16T13:50:02.511">
<testcase name="basic" file="tests/unit/libutil/args.cc" line="10" status="run" result="completed" time="0." timestamp="2024-06-16T13:50:02.511" classname="parseShebangContent" />
<testcase name="empty" file="tests/unit/libutil/args.cc" line="18" status="run" result="completed" time="0." timestamp="2024-06-16T13:50:02.511" classname="parseShebangContent" />
</testsuite>
</testsuites>

View File

@ -0,0 +1,16 @@
{ xunit-viewer, runCommand, ... }:
runCommand "test-xunit-viewer" {
nativeBuildInputs = [ xunit-viewer ];
} ''
mkdir $out
xunit-viewer -r ${./example.junit.xml} -o $out/index.html
( set -x
grep '<body' $out/index.html
# Can't easily grep for parts of the original data, because it ends up
# embedded as base64 encoded data (and slightly modified?).
# We'd have to really dissect it or render it with a browser.
# Fortunately, we've already caught the most severe packaging problems
# with just this.
)
''