AOEpeople/gulp-jasmine-browser

Name: gulp-jasmine-browser

Owner: AOE

Description: null

Created: 2015-04-22 07:16:04.0

Updated: 2015-04-22 07:16:05.0

Pushed: 2015-05-27 11:53:56.0

Homepage: null

Size: 132

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

gulp-jasmine-browser

Build Status

Installing

gulp-jasmine-browser is available as an npm package.

Usage
Create a Jasmine server to run specs in a browser

In gulpfile.js

gulp = require('gulp');
jasmineBrowser = require('gulp-jasmine-browser');

.task('jasmine', function() {
turn gulp.src(['src/**/*.js', 'spec/**/*_spec.js'])
.pipe(jasmineBrowser.specRunner())
.pipe(jasmineBrowser.server());

In gulp.src include all files you need for testing other than jasmine itself. This should include your spec files, and may also include your production JavaScript and CSS files.

Run jasmine tests headlessly

In gulpfile.js

gulp = require('gulp');
jasmineBrowser = require('gulp-jasmine-browser');

.task('jasmine-phantom', function() {
turn gulp.src(['src/**/*.js', 'spec/**/*_spec.js'])
.pipe(jasmineBrowser.specRunner({console: true}))
.pipe(jasmineBrowser.phantomjs());

Note the {console: true} passed into specRunner.

Run jasmine tests and get xml report (JUNIT)

In gulpfile.js

gulp = require('gulp');
jasmineBrowser = require('gulp-jasmine-browser');

.task('jasmine-phantom', function() {
turn gulp.src(['src/**/*.js', 'spec/**/*_spec.js'])
.pipe(jasmineBrowser.specRunner({xml: true}))
.pipe(jasmineBrowser.phantomjs({xml: true, out: 'path/to/file.xml'}));

Note the {xml: true} passed into specRunner and phantjomjs. With the {out: ''} property you can decide where the output shall be placed and how it shall be named (defaults to report.xml).

Usage with Webpack

If you would like to compile your front end assets with Webpack, for example to use commonjs style require statements, you can pipe the compiled assets into GulpJasmineBrowser.

In gulpfile.js

gulp = require('gulp');
jasmineBrowser = require('gulp-jasmine-browser');
webpack = require('gulp-webpack');

.task('jasmine', function() {
turn gulp.src('spec/**/*_spec.js'])
.pipe(webpack({watch: true, output: {filename: 'spec.js'}}))
.pipe(jasmineBrowser.specRunner())
.pipe(jasmineBrowser.server());

Development
Getting Started

The application requires the following external dependencies:

The rest of the dependencies are handled through:

install

Run tests with:

test

(c) Copyright 2015 Pivotal Software, Inc. All Rights Reserved.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.