Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpabloaj/f1ea60417f47897c940f to your computer and use it in GitHub Desktop.
Save juanpabloaj/f1ea60417f47897c940f to your computer and use it in GitHub Desktop.
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var paths = {
tests: ['*.js', 'test/*.js']
};
gulp.task('tests', function(){
return gulp.src(paths.tests, {read:false})
.pipe(mocha());
});
gulp.task('watch', function(){
return gulp.watch(paths.tests, ['tests']);
});
gulp.task('default', ['watch']);
{
"name": "no_terminate",
"version": "0.0.1",
"description": "gulp-mocha not terminate",
"main": "server.js",
"scripts": {
"test": "mocha"
},
"author": "JuanpabloAJ",
"license": "MIT",
"dependencies": {
"express": "^4.10.6"
},
"scripts": {
"postinstall": "mkdir -p test"
},
"devDependencies": {
"gulp": "^3.8.10",
"gulp-mocha": "^2.0.0",
"mocha": "^2.1.0",
"should": "^4.4.2",
"supertest": "^0.15.0"
}
}
var express = require('express');
var app = express();
module.exports.app = app;
var port = process.env.PORT || 8080;
var router = express.Router();
router.get('/', function(req, res){
res.json({ message: 'to test with gulp-mocha'});
});
app.use('/', router);
app.listen(port);
var request = require('supertest');
var app = require('./server').app;
var should = require('should');
describe('app test', function(){
it('app return json message', function(done){
request(app)
.get('/')
.expect(200)
.end(function(err, res){
res.body.message.should.match(/test/);
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment