Removed gulp, added jasmine

This patch removes gulp, and moves commands such as nsp and test
execution directly into package.json. Coverage threshold tests via
istanbul have also been added.
This commit is contained in:
Michael Krotscheck 2016-03-22 05:12:03 -07:00
parent 8807dc06bf
commit f2d20d7c77
5 changed files with 50 additions and 58 deletions

27
.istanbul.yml Normal file
View File

@ -0,0 +1,27 @@
verbose: false
instrumentation:
include-all-sources: true
reporting:
print: detail
reports:
- lcov
- html
dir: ./coverage
watermarks:
statements: [80, 100]
lines: [80, 100]
functions: [80, 100]
branches: [80, 100]
check:
global:
statements: 1
lines: 1
branches: 1
functions: 1
excludes: []
each:
statements: 1
lines: 1
branches: 1
functions: 1
excludes: []

View File

@ -1,47 +0,0 @@
(function () {
'use strict';
var path = require('path');
var gulp = require('gulp');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');
gulp.task('nsp', function (cb) {
nsp({package: path.resolve('package.json')}, cb);
});
gulp.task('pre-test', function () {
return gulp.src('generators/**/*.js')
.pipe(excludeGitignore())
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;
gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
});
gulp.task('watch', function () {
gulp.watch(['generators/**/*.js', 'test/**'], ['test']);
});
gulp.task('prepublish', ['nsp']);
gulp.task('default', ['test']);
})();

View File

@ -5,8 +5,9 @@
"description": "Yeoman Project Generator for OpenStack JavaScript Projects",
"main": "index.js",
"scripts": {
"test": "gulp",
"prepublish": "gulp prepublish",
"test": "istanbul cover jasmine",
"posttest": "istanbul check-coverage",
"prepublish": "nsp check",
"lint": "eslint ./"
},
"keywords": [
@ -25,18 +26,19 @@
"yosay": "^1.0.2"
},
"devDependencies": {
"yeoman-assert": "2.0.0",
"eslint": "1.10.3",
"eslint-config-openstack": "1.2.4",
"gulp": "3.9.0",
"gulp-exclude-gitignore": "1.0.0",
"gulp-istanbul": "0.10.3",
"gulp-mocha": "2.0.0",
"gulp-plumber": "1.0.0",
"gulp-nsp": "2.1.0"
"istanbul": "0.4.2",
"jasmine": "2.4.1",
"nsp": "2.2.1",
"yeoman-assert": "2.0.0"
},
"eslintConfig": {
"extends": "openstack"
"extends": "openstack",
"env": {
"node": true,
"jasmine": true
}
},
"repository": "https://github.com/krotscheck/generator-openstack"
}

View File

@ -5,7 +5,7 @@
var helpers = require('yeoman-generator').test;
describe('generator-openstack:app', function () {
before(function (done) {
beforeEach(function (done) {
helpers.run(path.join(__dirname, '../generators/app'))
.withOptions({someOption: true})
.withPrompts({someAnswer: true})

10
spec/support/jasmine.json Normal file
View File

@ -0,0 +1,10 @@
{
"spec_dir": "spec",
"spec_files": [
"**/*.js",
"!helpers/**/*.js"
],
"helpers": [
"helpers/**/*.js"
]
}