# gulp-xunit-runner

> A Gulp.js plugin to facilitate the running of XUnit unit tests on .Net assemblies.

Latest version **0.1.1** (published 2015-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-xunit-runner
pnpm add gulp-xunit-runner
yarn add gulp-xunit-runner
bun add gulp-xunit-runner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-03-02 |
| First published | 2015-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Stefan Billiet |
| Maintainers | stefanbilliet |
| Keywords | gulp, xunit, .net, gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-xunit-runner
- Repository: https://github.com/StefanBilliet/gulp-xunit-runner
- Issues: https://github.com/StefanBilliet/gulp-xunit-runner/issues
- npm.io page: https://npm.io/package/gulp-xunit-runner

## Dependencies (5)

- [sax](https://npm.io/package/sax.md) ~0.6.1
- [temp](https://npm.io/package/temp.md) ~0.8.1
- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.0
- [event-stream](https://npm.io/package/event-stream.md) ^3.1.7

## Recent versions

- 0.1.1 (latest) — 2015-03-02
- 0.1.0 — 2015-03-02

## README

#gulp-xunit-runner

[![Build Status](https://travis-ci.org/StefanBilliet/gulp-xunit-runner.svg?branch=master)](https://travis-ci.org/StefanBilliet/gulp-xunit-runner.svg?branch=master)

A [gulp.js](http://gulpjs.com/) plugin to facilitate running [XUnit](http://xunit.github.io/) tests on .NET assemblies. Much of this work was inspired by the [gulp-nunit-runner](https://github.com/keithmorris/gulp-nunit-runner) plugin.

##Installation
From the root of your project (where your `gulpfile.js` is), issue the following command:

```bat
npm install --save-dev gulp-xunit-runner
```

##Usage
The plugin uses standard `gulp.src` globs to retrieve a list of assemblies that should be tested with XUnit. By default the plugin looks for the XUnit console runner in your `PATH`. You can optionally specify the XUnit `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.

```javascript
var gulp = require('gulp'),
    xunit = require('gulp-xunit-runner');

gulp.task('unit-test', function () {
  return gulp.src(['**/*.Test.dll'], {read: false})
    .pipe(xunit({
      executable: 'C:/xunit/bin/xunit-console.exe',
    }));
});

```
This would result in the following command being executed (assuming you had Database and Services Test assemblies.)

```bat
C:/xunit/bin/xunit-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:\\xunit\\bin\\xunit-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 XUnit 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 XUnit documentation:

[http://xunit.github.io/#documentation](http://xunit.github.io/#documentation)

```javascript
var gulp = require('gulp'),
    xunit = require('gulp-xunit-runner');

gulp.task('unit-test', function () {
  return gulp.src(['**/*.Test.dll'], {read: false})
    .pipe(xunit({
      executable: 'C:/xunit/bin/xunit-console.exe',
      options: {
        nologo: true,
        xml: 'test_results.xml'
      }
    }));
});
```
This would result in the following command:

```bat
C:/xunit/bin/xunit-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 avialable options.

```js
xunit({
    // The XUnit bin folder or the full path of the console runner.
    // If not specified the XUnit bin folder must be in the `PATH`.
    executable: 'path to xunit console runner',

    // The options below map directly to the XUnit console runner. See here
    // for more info: http://www.xunit.org/index.php?p=consoleCommandLine&r=2.6.3
    options: {

        // Set parallelisation based on option.
        parallel: none - turn off all parallelization
                  collections - only parallelize collections
                  assemblies - only parallelize assemblies
                  all - parallelize assemblies & collections,

        // Maximum thread count for collection parallelization.
        maxthreads: 0 - run with unbounded thread count
                    >0 - limit task thread pool size to 'count',

        // Do not shadow copy assemblies.
        noshadow: true
                  false,

        // Forces TeamCity mode (normally auto-detected).
        teamcity: true
                  false,

        // Forces AppVeyor CI mode (normally auto-detected).
        appveyor: true
                  false,

        // Do not show the copyright message.
        nologo: true
                false,

        // Do not show progress messages.
        quiet: true
               false,

        // Wait for input after completion.
        wait: true
              false,

        // Launch the debugger to debug the tests.
        debug: true
               false,

        // Only run tests with matching name/value traits. If specified more than once, acts as an OR operation.
        trait: 'name=value',

        // Do not run tests with matching name/value traits. If specified more than once, acts as an AND operation.
        notrait: 'name=value',

        // Run a given test method (should be fully specified; i.e., 'MyNamespace.MyClass.MyTestMethod'). If specified more than once, acts as an OR operation
        method: 'name',

        // Run all methods in a given test class (should be fully specified; i.e., 'MyNamespace.MyClass'). If specified more than once, acts as an OR operation.
        class: 'name',

        // Output results to xUnit.net v2 style XML file.
        xml: 'filename',

        // Output results to xUnit.net v1 style XML file.
        xmlv1: 'filename',

        // Output results to NUnit-style XML file.
        nunit: 'filename',

        // Output results to HTML file.
        html: 'filename'
    }
});
```

## Release Notes

### 0.1.0 (02 March 2015)
- Initial release

---
_Source: https://npm.io/package/gulp-xunit-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
