mirror of
https://github.com/Lissy93/twitter-sentiment-visualisation.git
synced 2021-05-12 19:52:18 +03:00
Added mocha tests and coverage into gulp process
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,7 +2,5 @@ node_modules
|
||||
bower_components
|
||||
.idea
|
||||
*.idea
|
||||
test/logs
|
||||
test/awesome-reports
|
||||
.log
|
||||
reports
|
||||
*.log
|
||||
@@ -6,7 +6,8 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
"test": "mocha"
|
||||
"test": "mocha",
|
||||
"cover": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec"
|
||||
},
|
||||
"main": "app.js",
|
||||
"repository": {
|
||||
@@ -39,6 +40,7 @@
|
||||
"gulp-csslint": "^0.1.5",
|
||||
"gulp-filesize": "0.0.6",
|
||||
"gulp-footer": "^1.0.5",
|
||||
"gulp-istanbul": "^0.10.0",
|
||||
"gulp-jshint": "^1.11.2",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-minify-css": "^1.2.0",
|
||||
|
||||
@@ -3,14 +3,14 @@ var gulp = require('gulp');
|
||||
var bSync = require('browser-sync');
|
||||
var CONFIG = require('../tasks/config').CONFIG;
|
||||
|
||||
gulp.task('browser-sync', ['nodemon', 'scripts', 'styles'], function () {
|
||||
gulp.task('browser-sync', ['nodemon', 'scripts', 'styles', 'test'], function () {
|
||||
bSync.init({
|
||||
files: [CONFIG.SOURCE_ROOT+'/**/*.*'],
|
||||
proxy: 'http://localhost:3000',
|
||||
port: 4000,
|
||||
browser: ['google chrome']
|
||||
});
|
||||
gulp.watch(CONFIG.SOURCE_ROOT+'/**/*.{js,coffee}', ['scripts']);
|
||||
gulp.watch(CONFIG.SOURCE_ROOT+'/**/*.{js,coffee}', ['scripts', 'test']);
|
||||
gulp.watch(CONFIG.SOURCE_ROOT+'/**/*.{css,less}', ['styles']);
|
||||
gulp.watch(CONFIG.SOURCE_ROOT+"/**/*").on('change', bSync.reload);
|
||||
gulp.watch("views/**/*.jade").on('change', bSync.reload);
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
var gulp = require('gulp');
|
||||
var mocha = require('gulp-mocha');
|
||||
var istanbul = require('gulp-istanbul');
|
||||
|
||||
require('coffee-script/register')
|
||||
|
||||
/* Run all tests and produce coverage report */
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.src(['source/**/*.js', 'main.js'])
|
||||
.pipe(istanbul()) // Covering files
|
||||
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.on('finish', function () {
|
||||
gulp.src(['test/*.{js,coffee}'])
|
||||
.pipe(mocha())
|
||||
.pipe(istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // Enforce a coverage of at least 90%
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
|
||||
/* Run Mocha tests */
|
||||
gulp.task('test', function () {
|
||||
gulp.task('mocha', function () {
|
||||
return gulp.src('test/*.{js,coffee}')
|
||||
.pipe(mocha({compiler: 'nyan'}));
|
||||
});
|
||||
@@ -1,3 +1,4 @@
|
||||
--compilers coffee:coffee-script/register
|
||||
--recursive
|
||||
--reporter mochawesome --reporter-options reportDir=./test/awesome-reports
|
||||
--reporter mochawesome
|
||||
--reporter-options reportDir=./reports/awesome-reports
|
||||
--recursive
|
||||
Reference in New Issue
Block a user