Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
gulp-nunit-runner
Advanced tools
Readme
A Gulp.js plugin to facilitate running NUnit tests on .NET assemblies. Much of this work was inspired by the gulp-nunit plugin.
From the root of your project (where your gulpfile.js
is), issue the following command:
npm install --save-dev gulp-nunit-runner
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 = require('gulp'),
nunit = require('gulp-nunit-runner');
gulp.task('unit-test', function () {
return gulp.src(['**/*.Test.dll'], {read: false})
.pipe(nunit({
executable: 'C:/nunit/bin/nunit-console.exe',
}));
});
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 = require('gulp'),
nunit = require('gulp-nunit-runner');
gulp.task('unit-test', function () {
return gulp.src(['**/*.Test.dll'], {read: false})
.pipe(nunit({
executable: 'C:/nunit/bin/nunit-console.exe',
options: {
nologo: true,
config: 'Release',
transform: 'myTransform.xslt'
}
}));
});
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"
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.
nunit({
// The NUnit bin folder or the full path of the console runner.
// If not specified the NUnit bin folder must be in the `PATH`.
executable: 'c:/Program Files/NUnit/bin',
// [2.x] If the full path of the console runner is not specified this determines
// what version of the console runner is used. Defaults to anycpu.
// NOTE: This has been superseded by the 'x86' option below in 3.x.
// http://www.nunit.org/index.php?p=nunit-console&r=2.6.3
platform: 'anycpu|x86',
// [2.x] Output TeamCity service messages.
// NOTE: This has been superseded by the 'teamcity' option below in 3.x.
// https://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity
teamcity: true|false,
// Do not throw a gulp error and stop the stream on failing NUnit tests.
// This is useful on TeamCity, where tests can be muted after the tests
// are run, which allow the build to pass.
continueOnError: true|false,
// The options below map directly to the NUnit console runner. See here
// for more info: http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.3
options: {
// [3.x] Name of the test case(s), fixture(s) or namespace(s) to run.
test: ['TestSuite.Unit', 'TestSuite.Integration'],
// [3.x] Name of a file containing a list of the tests to run, one per line.
testist: 'TestsToRun.txt',
// [2.x] Name of the test case(s), fixture(s) or namespace(s) to run.
// NOTE: This has been superseded by the 'test' option above in 3.x.
run: ['TestSuite.Unit', 'TestSuite.Integration'],
// [2.x] Name of a file containing a list of the tests to run, one per line.
// NOTE: This has been superseded by the 'testlist' option above in 3.x.
runlist: 'TestsToRun.txt',
// [2.x] List of categories to include.
include: ['BaseLine', 'Unit'],
// [2.x] List of categories to exclude.
exclude: ['Database', 'Network'],
// [3.x] Test selection expression
where: 'cat != critical',
// Project configuration (e.g.: Debug) to load.
config: 'Debug',
// Process model for tests.
process: 'Single|Separate|Multiple',
// AppDomain Usage for tests.
domain: 'None|Single|Multiple',
// Framework version to be used for tests.
framework: 'net-1.1',
// [3.x] Run tests in a 32-bit process on 64-bit systems.
x86: true|false,
// [3.x] Dispose each test runner after it has finished running its tests.
"dispose-runners": true|false,
// Timeout for each test case in milliseconds.
timeout: 1000,
// [3.x] Random seed used to generate test cases.
seed: 5150,
// [3.x] Number of worker threads to be used in running tests.
workers: 5,
// Stop after the first test failure or error.
stoponerror: true|false,
// Wait for input before closing console window.
wait: true|false,
// [3.x] Pause before run to allow debugging.
pause: true|false,
// Work directory for output files.
work: 'BuildArtifacts',
// File to receive test output.
output: 'TestOutput.txt',
// File to receive test error output.
err: 'TestErrors.txt',
// Name of XML result file (Default: TestResult.xml)
result: 'TestResult.xml',
// [3.x] Save test info rather than running tests. Name of output file.
explore: 'TestInfo.xml',
// Suppress XML result output.
noresult: true|false,
// Label each test in stdOut.
labels: true|false,
// Set internal trace level.
trace: 'Off|Error|Warning|Info|Verbose',
// [3.x] Tells .NET to copy loaded assemblies to the shadowcopy directory.
shadowcopy: true|false,
// [2.x] Disable shadow copy when running in separate domain.
// NOTE In 3.x, The console runner now disables shadow copy by
// default. use new 'shadowcopy' option in 3.x to turn it on.
noshadow: true|false,
// [3.x] Turns on use of TeamCity service messages.
teamcity: true|false,
// [3.x] Suppress display of program information at start of run.
noheader: true|false,
// [3.x] Displays console output without color.
nocolor: true|false,
// [3.x] Display additional information as the test runs.
verbose: true|false,
// [2.x] Do not display the logo.
nologo: true|false,
// [2.x] Do not display progress.
nodots: true|false,
// [2.x] Apartment for running tests (Default is MTA).
apartment: 'MTA|STA',
// [2.x] Disable use of a separate thread for tests.
nothread: true|false,
// [2.x] Base path to be used when loading the assemblies.
basepath: 'src',
// [2.x] Additional directories to be probed when loading assemblies.
privatebinpath: ['lib', 'bin'],
// [2.x] Erase any leftover cache files and exit.
cleanup: true|false
}
});
mono
command to execute the nunit-console.exe
on non-windows systems (dbones).npmignore
child_process::spawn
, much simpler command building.FAQs
A Gulp.js plugin to facilitate the running of NUnit unit tests on .Net assemblies.
The npm package gulp-nunit-runner receives a total of 267 weekly downloads. As such, gulp-nunit-runner popularity was classified as not popular.
We found that gulp-nunit-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.