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,
"globals": {
"expect": true,
"sinon": true,
"describe" : true,
"it" : true,
"before" : true,

View File

@ -3,7 +3,6 @@ language: node_js
node_js:
- "6"
before_script:
- npm install -g grunt-cli
- mongo test_db --eval 'db.addUser("travis", "test");'
notifications:
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": {
"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": {
"addressparser": "^1.0.1",
@ -30,10 +34,8 @@
"devDependencies": {
"chai": "^3.5.0",
"co-mocha": "^1.1.2",
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"grunt-jscs": "^3.0.1",
"grunt-mocha-test": "^0.13.2",
"jscs": "^3.0.7",
"jshint": "^2.9.4",
"mocha": "^3.2.0",
"sinon": "^1.17.4",
"supertest": "^2.0.1"

View File

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

View File

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

View File

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

View File

@ -1,15 +1,11 @@
'use strict';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const config = require('config');
const nodemailer = require('nodemailer');
const Email = require('../../src/email/email');
const Mongo = require('../../src/dao/mongo');
const PGP = require('../../src/service/pgp');
const PublicKey = require('../../src/service/public-key');
const expect = require('chai').expect;
const sinon = require('sinon');
describe('Public Key Integration Tests', function() {
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';
require('co-mocha')(require('mocha')); // monkey patch mocha for generators
const expect = require('chai').expect;
const log = require('npmlog');
const Email = require('../../src/email/email');
const nodemailer = require('nodemailer');
const sinon = require('sinon');
describe('Email Unit Tests', () => {
let email, sendFnStub;

View File

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

View File

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