Merge pull request #16 from mailvelope/npm_script

Replace grunt with npm scripts
This commit is contained in:
Tankred Hase 2017-08-14 11:51:27 +08:00 committed by GitHub
commit 9f922ce116
13 changed files with 20 additions and 69 deletions

View File

@ -15,6 +15,8 @@
"esnext": true, "esnext": true,
"globals": { "globals": {
"expect": true,
"sinon": true,
"describe" : true, "describe" : true,
"it" : true, "it" : true,
"before" : true, "before" : true,

View File

@ -3,7 +3,6 @@ language: node_js
node_js: node_js:
- "6" - "6"
before_script: before_script:
- npm install -g grunt-cli
- mongo test_db --eval 'db.addUser("travis", "test");' - mongo test_db --eval 'db.addUser("travis", "test");'
notifications: notifications:
email: email:

View File

@ -1,41 +0,0 @@
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
all: ['*.js', 'src/**/*.js', 'test/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
jscs: {
src: ['*.js', 'src/**/*.js', 'test/**/*.js'],
options: {
config: ".jscsrc"
}
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: [
'test/unit/*.js',
'test/integration/*.js',
]
}
}
});
// Load the plugin(s)
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-mocha-test');
// Default task(s).
grunt.registerTask('test', ['jshint', 'jscs', 'mochaTest']);
};

View File

@ -11,7 +11,11 @@
}, },
"scripts": { "scripts": {
"start": ": ${NODE_ENV=development} && node index.js", "start": ": ${NODE_ENV=development} && node index.js",
"test": ": ${NODE_ENV=development} && grunt test" "test": ": ${NODE_ENV=development} && npm run test:jshint && npm run test:jscs && npm run test:unit && npm run test:integration",
"test:jshint": "jshint *.js src/**/*.js test/**/*.js",
"test:jscs": "jscs *.js src/**/*.js test/**/*.js",
"test:unit": "mocha --opts test/mocha.opts ./test/unit/",
"test:integration": "mocha --opts test/mocha.opts ./test/integration"
}, },
"dependencies": { "dependencies": {
"addressparser": "^1.0.1", "addressparser": "^1.0.1",
@ -30,10 +34,8 @@
"devDependencies": { "devDependencies": {
"chai": "^3.5.0", "chai": "^3.5.0",
"co-mocha": "^1.1.2", "co-mocha": "^1.1.2",
"grunt": "^1.0.1", "jscs": "^3.0.7",
"grunt-contrib-jshint": "^1.0.0", "jshint": "^2.9.4",
"grunt-jscs": "^3.0.1",
"grunt-mocha-test": "^0.13.2",
"mocha": "^3.2.0", "mocha": "^3.2.0",
"sinon": "^1.17.4", "sinon": "^1.17.4",
"supertest": "^2.0.1" "supertest": "^2.0.1"

View File

@ -1,14 +1,10 @@
'use strict'; 'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const request = require('supertest'); const request = require('supertest');
const Mongo = require('../../src/dao/mongo'); const Mongo = require('../../src/dao/mongo');
const nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
const config = require('config'); const config = require('config');
const fs = require('fs'); const fs = require('fs');
const expect = require('chai').expect;
const sinon = require('sinon');
describe('Koa App (HTTP Server) Integration Tests', function() { describe('Koa App (HTTP Server) Integration Tests', function() {
this.timeout(20000); this.timeout(20000);

View File

@ -1,8 +1,5 @@
'use strict'; 'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const expect = require('chai').expect;
const config = require('config'); const config = require('config');
const Email = require('../../src/email/email'); const Email = require('../../src/email/email');
const tpl = require('../../src/email/templates.json'); const tpl = require('../../src/email/templates.json');

View File

@ -1,10 +1,7 @@
'use strict'; 'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const config = require('config'); const config = require('config');
const Mongo = require('../../src/dao/mongo'); const Mongo = require('../../src/dao/mongo');
const expect = require('chai').expect;
describe('Mongo Integration Tests', function() { describe('Mongo Integration Tests', function() {
this.timeout(20000); this.timeout(20000);

View File

@ -1,15 +1,11 @@
'use strict'; 'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const config = require('config'); const config = require('config');
const nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
const Email = require('../../src/email/email'); const Email = require('../../src/email/email');
const Mongo = require('../../src/dao/mongo'); const Mongo = require('../../src/dao/mongo');
const PGP = require('../../src/service/pgp'); const PGP = require('../../src/service/pgp');
const PublicKey = require('../../src/service/public-key'); const PublicKey = require('../../src/service/public-key');
const expect = require('chai').expect;
const sinon = require('sinon');
describe('Public Key Integration Tests', function() { describe('Public Key Integration Tests', function() {
this.timeout(20000); this.timeout(20000);

2
test/mocha.opts Normal file
View File

@ -0,0 +1,2 @@
--recursive
-r ./test/setup.js

9
test/setup.js Normal file
View File

@ -0,0 +1,9 @@
'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const expect = require('chai').expect;
const sinon = require('sinon');
global.expect = expect;
global.sinon = sinon;

View File

@ -1,13 +1,8 @@
'use strict'; 'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const expect = require('chai').expect;
const log = require('npmlog'); const log = require('npmlog');
const Email = require('../../src/email/email'); const Email = require('../../src/email/email');
const nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
const sinon = require('sinon');
describe('Email Unit Tests', () => { describe('Email Unit Tests', () => {
let email, sendFnStub; let email, sendFnStub;

View File

@ -1,11 +1,9 @@
'use strict'; 'use strict';
const fs = require('fs'); const fs = require('fs');
const expect = require('chai').expect;
const log = require('npmlog'); const log = require('npmlog');
const openpgp = require('openpgp'); const openpgp = require('openpgp');
const PGP = require('../../src/service/pgp'); const PGP = require('../../src/service/pgp');
const sinon = require('sinon');
describe('PGP Unit Tests', () => { describe('PGP Unit Tests', () => {
let pgp, key1Armored, key2Armored, key3Armored; let pgp, key1Armored, key2Armored, key3Armored;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const expect = require('chai').expect;
const util = require('../../src/service/util'); const util = require('../../src/service/util');
describe('Util Unit Tests', () => { describe('Util Unit Tests', () => {