gulp-nunit-runner
A Gulp.js plugin to facilitate running NUnit tests on .NET assemblies. Much of this work was inspired by the gulp-nunit plugin.
Installation
From the root of your project (where your gulpfile.js
is), issue the following command:
npm install --save-dev gulp-nunit-runner
Usage
The plugin uses standard gulp.src
globs to retrieve a list of assemblies that should be tested with Nunit. By default the plugin looks for the NUnit console runner in your PATH
. You can optionally specify the NUnit bin
folder or the full path of the runner as demonstrated below. You should add {read: false}
to your gulp.src
so that it doesn't actually read the files and only grabs the file names.
var gulp = nunit = ; gulp;
This would result in the following command being executed (assuming you had Database and Services Test assemblies.)
C:/nunit/bin/nunit-console.exe "C:\full\path\to\Database.Test.dll" "C:\full\path\to\Services.Test.dll"
Note: If you use Windows paths with \
's, you need to escape them with another \
. (e.g. C:\\nunit\\bin\\nunit-console.exe
). However, you may also use forward slashes /
instead which don't have to be escaped.
You may also add options that will be used as NUnit command line switches. Any property that is a boolean true
will simply be added to the command line, String values will be added to the switch parameter separated by a colon and arrays will be a comma seperated list of values.
For more information on available switches, see the NUnit documentation:
http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.3
var gulp = nunit = ; gulp;
This would result in the following command:
C:/nunit/bin/nunit-console.exe /nologo /config:"Release" /transform:"myTransform.xslt" "C:\full\path\to\Database.Test.dll" "C:\full\path\to\Services.Test.dll"
Options
Below are all available options. With the release of NUnit 3.x, some options have been removed and some added. Version specific options have been labeled with the version they apply to. For more information on deprecated options see here. For more information on new options see here.
;
Release Notes
1.2.3
- Updated event-stream dependency for security issue. (thanks alexmaris)
1.2.2
- Add parsing for number type options/switches (alexmaris)
1.2.1
- Update dev dependencies
1.2.0
- Add continueOnError option (cable729)
1.1.0
- Force using the
mono
command to execute thenunit-console.exe
on non-windows systems (dbones)
1.0.0
- Add handling of where switch for nunit3-console test runner (Tuukka Turto)
- Dependency update
- Update Travis tests to also test on node versions 4.x and 6.x
- Bump version to 1.0.0
0.5.2
- Add check for output file before creating the TeamCity output. (Mike O'Brien)
- Clean up publish package with
.npmignore
0.5.1
- Fix #13 Running from Visual Studio Task Runner Fails
0.5.0
- Make the command line switch aware of OS so that it uses the correct character when running under mono on linux/mac.
0.4.2 (28 June 2015)
- Add NUnit 3.x options and labled 2.x options to README.md
0.4.1 (20 Nov 2014)
- Remove quotes around multi args.
0.4.0 (13 Nov 2014)
- Add build script with test, lint and watch.
- Add Travis CI integration.
- Add a TeamCity reporter.
- Add support for multi options e.g. include, exclude and privatebinpath.
- Add the ability to omit the explicit nunit path entirely and rely on it being in the PATH.
- Add the ability to just supply the path to the bin folder but not explicitly specify the filename.
- Add a platform flag that goes along with both exectable options to chose the x86 or anycpu version of nunit; defaults to anycpu.
- Document all the config options in the README.
0.3.0 (30 Sept 2014)
- Fixes large amount of writes by NUnit tests causing node to crash
- Switched to using
child_process::spawn
, much simpler command building.
0.2.0 (28 Sept 2014)
- Fixes #2 "Simultaneous runs of test tasks cause duplication"
- Major rearchitecture of plugin by @VoiceOfWisdom
- Adds release notes to README.md
0.1.2 (4 Sept 2014)
- Fixes #1 "runner fails if executable path has space"
0.1.1 (10 Aug 2014)
- Documentation update
0.1.0 (10 Aug 2014)
- Initial release