about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2024-06-16 16:27:18 +0200
committerGitHub <noreply@github.com>2024-06-16 16:27:18 +0200
commita94dfb6e0a0ca7999943cf5c2538a69cb19b071c (patch)
treea4d289fc67482eb0306c83c9ee447cadbf50da0f
parent61e65b810d6bfa22ca7a5f1d88719485ba55cf54 (diff)
parent5b8c64f198ff59b13c651ac80967f6052f6f987b (diff)
Merge pull request #319020 from pluiedev/init/xunit-viewer
xunit-viewer: init at 10.6.1
-rw-r--r--pkgs/by-name/xu/xunit-viewer/package.nix42
-rw-r--r--pkgs/by-name/xu/xunit-viewer/test/example.junit.xml8
-rw-r--r--pkgs/by-name/xu/xunit-viewer/test/example.nix16
3 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/by-name/xu/xunit-viewer/package.nix b/pkgs/by-name/xu/xunit-viewer/package.nix
new file mode 100644
index 0000000000000..7c31b82aac7b3
--- /dev/null
+++ b/pkgs/by-name/xu/xunit-viewer/package.nix
@@ -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;
+  };
+}
diff --git a/pkgs/by-name/xu/xunit-viewer/test/example.junit.xml b/pkgs/by-name/xu/xunit-viewer/test/example.junit.xml
new file mode 100644
index 0000000000000..a87b270fe2f3f
--- /dev/null
+++ b/pkgs/by-name/xu/xunit-viewer/test/example.junit.xml
@@ -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>
diff --git a/pkgs/by-name/xu/xunit-viewer/test/example.nix b/pkgs/by-name/xu/xunit-viewer/test/example.nix
new file mode 100644
index 0000000000000..574b9d784951e
--- /dev/null
+++ b/pkgs/by-name/xu/xunit-viewer/test/example.nix
@@ -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.
+  )
+''