Skip to content

Options

base

Base directory of the tests, will be removed from the test file path. This makes it possible to show the relative path from the git repo, instead of ugly Nix store paths.

Type:

string

Default value:

""

Declared in:

skip

Tests to skip, is passed to Nixtest's --skip param.

Type:

string

Default value:

""

Declared in:

suites

Define your test suites here, every test belongs to a suite.

Type:

attribute set of (submodule)

Default value:

{ }

Example value:

{
  "Suite A" = {
    tests = [
      {
        name = "Some Test";
      }
    ];
  };
}

Declared in:

suites.<name>.name

Name of the suite, uses attrset name by default.

Type:

string

Default value:

name

Declared in:

suites.<name>.pos

Position for tests, use __curPos for automatic insertion of current position. This will set pos for every test of this suite, useful if the suite's tests are all in a single file.

Type:

attribute set

Default value:

unset

Example value:

__curPos

Declared in:

suites.<name>.tests

Define tests of this suite here.

Type:

list of (submodule)

Default value:

[ ]

Declared in:

suites.<name>.tests.*.actual

Actual value of the test. Remember, the values are serialized (see here).

Type:

anything

Default value:

unset

Declared in:

suites.<name>.tests.*.actualDrv

Actual value of the test, but as a derivation. Nixtest will build this derivation when running the test, then compare the contents of the resulting file to the expected value.

Type:

package

Default value:

unset

Declared in:

suites.<name>.tests.*.description

Short description of the test.

Type:

string

Default value:

unset

Declared in:

suites.<name>.tests.*.expected

Expected value of the test. Remember, the values are serialized (see here).

Type:

anything

Default value:

unset

Declared in:

suites.<name>.tests.*.format

Which format to use for serializing arbitrary values. Required since this config is serialized to JSON for passing it to Nixtest, so no Nix-values can be used directly.

  • json: serializes the data to json using builtins.toJSON
  • pretty: serializes the data to a "pretty" format using lib.generators.toPretty

Type:

one of "json", "pretty"

Default value:

"json"

Declared in:

suites.<name>.tests.*.name

Name of this test.

Type:

string

Declared in:

suites.<name>.tests.*.pos

Position of test, use __curPos for automatic insertion of current position.

Type:

attribute set

Default value:

unset

Declared in:

suites.<name>.tests.*.script

Script to run for the test. Nixtest will run this, failing the test if it exits with a non-zero exit code.

Type:

string

Default value:

unset

Declared in:

suites.<name>.tests.*.type

Type of test, has to be one of "unit", "snapshot" or "script".

Type:

one of "unit", "snapshot", "script"

Default value:

"unit"

Declared in: