Skip to content

FedericoCeratto/nim-testrunner

Repository files navigation

Test runner for Nim

CircleCI badge tags License

Welcome to Nim test runner. This tool runs the Nim compiler against a set of source files. It’s meant to compile and run unittest files but it can also be used to compile other source files.

It supports globbing and can run tests automatically when source files are changed.

Generates reports in JUnit format.

Note
File change monitoring and desktop notifications works only on Linux
Syntax:
testurunner ['test filename globbing'...] [-m [:'monitored filename globbing']] [ -- compiler flags]
testrunner 'tests/**/*.nim'
testrunner -m
testrunner -m:'*.nim' -- -p:.
testrunner mytest.nim 'tests/*.nim' -m:'**/*.nim' -d -- -d:ssl
testrunner (-h | --help)
Options:
-h --help       show help
-d --debug      debug mode
-m --monitor    without any argument, monitor **/*.nim
-m:'<glob>'     monitor globbing. Remember the colon ":"
--basedir <dir> basedir
-c --conf       config file path
--nocolor       disable color and set NIMTEST_NO_COLOR=1
-o --norun      do not run test files, run "nim c" only
-q --nonotify   do not send desktop notifications (enabled only with -m on Linux)
--junit:<fname> write out JUnit summary (default: junit.xml)

Protect globbings with single quotes.

Double asterisk matches nested subdirectories. E.g. 'tests/**/*.nim' will match Nim files under tests/ and any subdirectory.

(you might have to protect the asterisks from your shell using single quotes)

Anything after "--" will be used as a compiler option for Nim.

If no test globs are passed, the following will be used: test_*.nim test/*.nim tests/*.nim

Testrunner will also parse .testrunner.conf if available, unless a different config file is specified.

Install testrunner:

nimble install testrunner

Install fswatch library (OS-dependent) or build with testrunner using -d:nofswatch to disable fswatch support

# Debian and derivatives
sudo apt-get install libfswatch11

# MacPorts
port install fswatch

# Homebrew
brew install fswatch

Output examples

Success
Figure 1. Success

Success
Figure 2. Failure

Contributions are welcome.