13 unstable releases (3 breaking)

0.4.3 Feb 17, 2020
0.4.2 Jan 6, 2020
0.3.0 Dec 30, 2019
0.2.2 Dec 30, 2019
0.1.4 Dec 29, 2019

#491 in Testing

Download history 15/week @ 2024-02-25 4/week @ 2024-03-03 53/week @ 2024-03-31

53 downloads per month

BSD-2-Clause

13KB
312 lines

nix-test-runner

Simple cli tool to run nix expression tests.

Usage

## my-tests.nix
{
  testFailed = {
    expr = builtins.add 1 1;
    expected = 1;
  };
  testPassed = {
    expr = builtins.add 1 1;
    expected = 2;
  };
}

$ nix-test my-tests.nix

    testFailed

        2
        
         Expect.equal
        
        1


    TEST RUN FAILED

    Duration: 72 ms
    Passed:   1
    Failed:   1
                                    %                                                
~
 

You can get different output formats using --reporter junit|json|human.

This uses lib.debug.runTests under the hood and doesn't change any behaviour of nix, it's merly a wrapper around nix-instantiate.

Dependencies

~4–12MB
~135K SLoC