Thanks to visit codestin.com
Credit goes to lib.rs

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

#1210 in Testing

26 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

~5.5–9MB
~158K SLoC