https://github.com/jonkemp/gulp-qunit
Run QUnit unit tests in a headless PhantomJS instance.
https://github.com/jonkemp/gulp-qunit
gulp-plugin qunit
Last synced: 7 months ago
JSON representation
Run QUnit unit tests in a headless PhantomJS instance.
- Host: GitHub
- URL: https://github.com/jonkemp/gulp-qunit
- Owner: jonkemp
- License: mit
- Created: 2014-01-20T22:16:13.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T18:30:06.000Z (over 3 years ago)
- Last Synced: 2025-02-27T15:32:38.515Z (7 months ago)
- Topics: gulp-plugin, qunit
- Language: JavaScript
- Homepage:
- Size: 521 KB
- Stars: 24
- Watchers: 5
- Forks: 19
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# [gulp](https://github.com/gulpjs/gulp)-qunit  [](https://coveralls.io/github/jonkemp/gulp-qunit?branch=master)
[](https://nodei.co/npm/gulp-qunit/)
> Run QUnit unit tests in a headless PhantomJS instance.
Run QUnit unit tests in a PhantomJS-powered headless test runner, providing basic console output for QUnit tests. Uses the [phantomjs](https://github.com/Medium/phantomjs) node module and the [PhantomJS Runner QUnit Plugin](https://github.com/jonkemp/qunit-phantomjs-runner).
Inspired by the grunt plugin [grunt-contrib-qunit](https://github.com/gruntjs/grunt-contrib-qunit).

## Install
Install with [npm](https://npmjs.org/package/gulp-qunit)
```bash
$ npm install --save-dev gulp-qunit
```## Usage
```js
var gulp = require('gulp'),
qunit = require('gulp-qunit');gulp.task('test', function() {
return gulp.src('./qunit/test-runner.html')
.pipe(qunit());
});
```With options:
```js
var gulp = require('gulp'),
qunit = require('gulp-qunit');gulp.task('test', function() {
return gulp.src('./qunit/test-runner.html')
.pipe(qunit({'phantomjs-options': ['--ssl-protocol=any']}));
});
```With page options:
```js
var gulp = require('gulp'),
qunit = require('gulp-qunit');gulp.task('test', function() {
return gulp.src('./qunit/test-runner.html')
.pipe(qunit({'page': {
viewportSize: { width: 1280, height: 800 }
}}));
});
```You no longer need this plugin to run QUnit tests in your gulp tasks. Now you can do this with [node-qunit-phantomjs](https://github.com/jonkemp/node-qunit-phantomjs), a stand alone module. It can also be used via command line, and it has an option for more verbose test reporting.
```js
var gulp = require('gulp'),
qunit = require('node-qunit-phantomjs');gulp.task('test', function() {
qunit('./qunit/test-runner.html');
});
```With phantomjs2:
```js
var gulp = require('gulp'),
qunit = require('gulp-qunit');gulp.task('test', function() {
return gulp.src('./qunit/test-runner.html')
.pipe(qunit({'binPath': require('phantomjs2').path}));
});
```## API
### qunit(options)
#### options.timeout
Type: `Number`
Default: `5`Pass a number or string value to override the default timeout of 5 seconds.
#### options.phantomjs-options
Type: `Array`
Default: `None`These options are passed on to PhantomJS. See the [PhantomJS documentation](http://phantomjs.org/api/command-line.html) for more information.
#### options.page
Type: `Object`
Default: `None`These options are passed on to PhantomJS. See the [PhantomJS documentation](http://phantomjs.org/page-automation.html) for more information.
#### options.binPath
Type: `String`
Default: require("phantomjs").pathThe option is used to execute phantomjs binary path
#### options.runner
Type: `String`
Default: require.resolve('qunit-phantomjs-runner')This option is used to configure the test runner used to control phantomjs
## License
MIT © [Jonathan Kemp](http://jonkemp.com)