gulp-jasmine-phantom
Advanced tools
Comparing version 1.0.0 to 1.0.1
55
index.js
@@ -12,5 +12,30 @@ 'use strict' | ||
/** | ||
* Removes the specRunner.html file | ||
**/ | ||
var cleanup = function(path) { | ||
fs.unlink(path); | ||
}; | ||
/** | ||
* Executes Phantom with the specified arguments | ||
* | ||
* childArguments: Array of options to pass Phantom | ||
* [jasmine-runner.js, specRunner.html] | ||
**/ | ||
var runPhantom = function(childArguments) { | ||
execFile('phantomjs', childArguments, function(error, stdout, stderr) { | ||
gutil.log('Start running specs'); | ||
console.log(stdout); | ||
if (stderr !== '') { | ||
gutil.log('gulp-jasmine-phantom: Failed to open test runner ' + gutil.colors.blue(childArguments[1])); | ||
gutil.log(gutil.colors.red('error: '), stderr); | ||
} | ||
if(options.keepRunner === undefined || options.keepRunner === false) { | ||
cleanup(childArguments[1]); | ||
} | ||
}.bind(this)); | ||
}; | ||
@@ -45,2 +70,3 @@ //If we are processing integration tests with phantomjs | ||
// Create the compile version of the specRunner from Handlebars | ||
var specData = handlebar.compile(data), | ||
@@ -58,16 +84,3 @@ specCompiled = specData({files: filePaths}); | ||
// Execute the file with phantomjs | ||
execFile('phantomjs', childArgs, function(error, stdout, stderr) { | ||
gutil.log('Start running specs'); | ||
console.log(stdout); | ||
if (stderr !== '') { | ||
gutil.log('gulp-jasmine-phantom: Failed to open test runner ' + gutil.colors.blue(childArgs[1])); | ||
gutil.log(gutil.colors.red('error: '), stderr); | ||
} | ||
if(options.keepRunner === undefined || options.keepRunner === false) { | ||
cleanup(childArgs[1]); | ||
} | ||
}.bind(this)); | ||
runPhantom(childArgs); | ||
}); | ||
@@ -82,10 +95,6 @@ }); | ||
terminalReporter = require('./lib/terminal-reporter.js').TerminalReporter; | ||
gutil.log('Running Jasmine with minijasminenode2'); | ||
return through.obj( | ||
// ----------------- | ||
// Transform function | ||
// Takes in each file and adds it to the list of specs | ||
// ----------------- | ||
function(file, encoding, callback) { | ||
// If file is null exit with callback | ||
if (file.isNull()) { | ||
@@ -96,5 +105,2 @@ callback(null, file); | ||
// ----------------- | ||
// Currently do not support streams | ||
// ----------------- | ||
if (file.isStream()) { | ||
@@ -105,10 +111,5 @@ callback(new gutil.PluginError('gulp-jasmine-phantom', 'Streaming not supported')); | ||
miniJasmineLib.addSpecs(file.path); | ||
callback(null, file); | ||
}, | ||
// ----------------- | ||
// Flush function | ||
// Finishes up the stream and runs all the test cases that have been provided | ||
// ----------------- | ||
function(callback) { | ||
@@ -115,0 +116,0 @@ try { |
{ | ||
"name": "gulp-jasmine-phantom", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Jasmine 2.0 suite runner, optionally with PhantomJS", | ||
@@ -11,3 +11,5 @@ "license": "MIT", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"lib/", | ||
"vendor/" | ||
], | ||
@@ -37,3 +39,2 @@ "keywords": [ | ||
"gulp": "^3.8.7", | ||
"gulp-watch": "^1.0.2", | ||
"jasmine": "^2.0.1", | ||
@@ -40,0 +41,0 @@ "jasmine-fixture": "^1.0.8" |
@@ -51,2 +51,21 @@ gulp-jasmine-phantom | ||
Also, remember you can always run any multitude of tests using different Gulp tasks. For example, running unit tests and integration tests asynchronously. | ||
```javascript | ||
var gulp = require('gulp'); | ||
var jasmine = require('gulp-jasmine-phantom'); | ||
gulp.task('unitTests', function () { | ||
return gulp.src('spec/test.js') | ||
.pipe(jasmine()); | ||
}); | ||
gulp.task('integrationTests', function() { | ||
return gulp.src('spec/test.js') | ||
.pipe(jasmine({ | ||
integration: true | ||
})); | ||
}); | ||
``` | ||
Options | ||
@@ -76,3 +95,3 @@ ------- | ||
* [https://github.com/dflynn15](Daniel Flynn) | ||
* [https://github.com/robtarr](Rob Tarr) | ||
* [Daniel Flynn](https://github.com/dflynn15) | ||
* [Rob Tarr](https://github.com/robtarr) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
121970
4
12
3052
96