mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
xunit-viewer: Add basic tests
This commit is contained in:
parent
23ab0c4be3
commit
5b8c64f198
@ -3,6 +3,8 @@
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
callPackage,
|
||||
testers, xunit-viewer,
|
||||
}:
|
||||
let
|
||||
version = "10.6.1";
|
||||
@ -22,6 +24,14 @@ buildNpmPackage {
|
||||
|
||||
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";
|
||||
|
8
pkgs/by-name/xu/xunit-viewer/test/example.junit.xml
Normal file
8
pkgs/by-name/xu/xunit-viewer/test/example.junit.xml
Normal 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>
|
16
pkgs/by-name/xu/xunit-viewer/test/example.nix
Normal file
16
pkgs/by-name/xu/xunit-viewer/test/example.nix
Normal 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.
|
||||
)
|
||||
''
|
Loading…
Reference in New Issue
Block a user