From fc57776453c8647f584bf7c64c7d7de0aea3ea0e Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 3 Jan 2017 12:16:36 -0800 Subject: [PATCH] packaging and test cleanups - remove grunt entirely (greenkeeper.io replaces grunt versioncheck) - rereplace @godsflaw customized nodeunit tests with standard nodeunit tests (faster to install from npm than github) --- .travis.yml | 1 - Gruntfile.js | 49 -------------------------- package.json | 11 ++---- tests/plugins/aliases.js | 56 +++++++++++++++--------------- tests/plugins/log.elasticsearch.js | 4 +-- tests/plugins/relay.js | 8 ++--- tests/plugins/tls.js | 12 +++---- 7 files changed, 43 insertions(+), 98 deletions(-) delete mode 100644 Gruntfile.js diff --git a/.travis.yml b/.travis.yml index 4112f0d18..24a21935d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,6 @@ env: # end: these are required for building on node.js v4 before_script: - - npm install -g grunt-cli script: - npm run lint diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index e52c9ed41..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -module.exports = function(grunt) { - - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-eslint'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-version-check'); - - // Project configuration. - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - eslint: { - src: { - src: ['*.js', 'plugins/**/*.js' ] - }, - bin: { - src: [ 'bin/haraka', 'bin/spf', 'bin/dkimverify' ] - }, - test: { - src: ['tests/**/*.js'], - } - }, - jshint: { - options: { - jshintrc: true, - }, - toplevel:[ '*.js' ], - bin: [ 'bin/**/*.js' ], - plugins: [ 'plugins/**/*.js' ], - test: [ 'tests/**/*.js' ], - }, - clean: { - cruft: ['npm-debug.log'], - dist: [ 'node_modules' ] - }, - versioncheck: { - target: { - options: { - skip : ['semver', 'npm'], - hideUpToDate : false - } - } - }, - }); - - grunt.registerTask('lint', ['eslint']); - grunt.registerTask('default', ['eslint']); -}; diff --git a/package.json b/package.json index a529c4c11..0c3f52d87 100644 --- a/package.json +++ b/package.json @@ -47,14 +47,9 @@ "vs-stun" : "~0.0.7" }, "devDependencies": { - "nodeunit" : "https://github.com/godsflaw/nodeunit/archive/master.tar.gz", + "nodeunit" : "*", "haraka-test-fixtures" : "*", - "eslint" : ">=2.0.0", - "grunt" : "*", - "grunt-contrib-clean" : "*", - "grunt-contrib-jshint" : "*", - "grunt-version-check" : "*", - "grunt-eslint" : "*" + "eslint" : ">=2" }, "bugs": { "mail": "helpme@gmail.com", @@ -68,7 +63,7 @@ }, "scripts": { "test": "node run_tests", - "lint": "grunt lint", + "lint": "./node_modules/.bin/eslint *.js plugins/**/*.js bin/haraka bin/spf bin/dkimverify tests/**/*.js", "cover": "NODE_ENV=cov ./node_modules/.bin/istanbul cov run_tests" } } diff --git a/tests/plugins/aliases.js b/tests/plugins/aliases.js index af3b49150..e7ad12f99 100644 --- a/tests/plugins/aliases.js +++ b/tests/plugins/aliases.js @@ -55,8 +55,8 @@ exports.aliases = { setUp : _set_up, 'should have register function' : function (test) { test.expect(2); - test.isNotNull(this.plugin); - test.isFunction(this.plugin.register); + test.ok(this.plugin); + test.equal('function', typeof this.plugin.register); test.done(); }, 'register function should inherit from queue/discard' : function (test) { @@ -78,14 +78,14 @@ exports.aliases = { 'register_hook() should register available function' : function (test) { test.expect(3); test.equals(this.plugin.register_hook.args[1], 'aliases'); - test.isNotNull(this.plugin.aliases); - test.isFunction(this.plugin.aliases); + test.ok(this.plugin.aliases); + test.equal('function', typeof this.plugin.aliases); test.done(); }, 'aliases hook always returns next()' : function (test) { var next = function (action) { test.expect(1); - test.isUndefined(action); + test.equals(undefined, action); test.done(); }; @@ -121,9 +121,9 @@ exports.aliases = { var next = function (action) { test.expect(4); - test.isUndefined(this.connection.transaction.notes.discard); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.equals(undefined, this.connection.transaction.notes.discard); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -138,8 +138,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -154,8 +154,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -170,8 +170,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -186,8 +186,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -202,8 +202,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -242,8 +242,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -258,8 +258,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -274,8 +274,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to.pop(), result); test.done(); }.bind(this); @@ -290,8 +290,8 @@ exports.aliases = { var next = function (action) { test.expect(3); - test.isNotNull(this.connection.transaction.rcpt_to); - test.isArray(this.connection.transaction.rcpt_to); + test.ok(this.connection.transaction.rcpt_to); + test.ok(Array.isArray(this.connection.transaction.rcpt_to)); test.deepEqual(this.connection.transaction.rcpt_to, result); test.done(); }.bind(this); @@ -307,7 +307,7 @@ exports.aliases = { var next = function (action) { test.expect(1); - test.isUndefined(this.connection.transaction.notes.discard); + test.equals(undefined, this.connection.transaction.notes.discard); test.done(); }.bind(this); @@ -322,7 +322,7 @@ exports.aliases = { var next = function (action) { test.expect(1); - test.isUndefined(this.connection.transaction.notes.discard); + test.equals(undefined, this.connection.transaction.notes.discard); test.done(); }.bind(this); diff --git a/tests/plugins/log.elasticsearch.js b/tests/plugins/log.elasticsearch.js index ca9c0aba7..8f96f51b8 100644 --- a/tests/plugins/log.elasticsearch.js +++ b/tests/plugins/log.elasticsearch.js @@ -24,8 +24,8 @@ exports.register = { setUp : _set_up, 'has a register function' : function (test) { test.expect(2); - test.isNotNull(this.plugin); - test.isFunction(this.plugin.register); + test.ok(this.plugin); + test.equal('function', typeof this.plugin.register); test.done(); }, /* diff --git a/tests/plugins/relay.js b/tests/plugins/relay.js index 0828f06e2..d5b0c713c 100644 --- a/tests/plugins/relay.js +++ b/tests/plugins/relay.js @@ -19,8 +19,8 @@ exports.plugin = { setUp : _set_up, 'should have register function' : function (test) { test.expect(2); - test.isNotNull(this.plugin); - test.isFunction(this.plugin.register); + test.ok(this.plugin); + test.equal('function', typeof this.plugin.register); test.done(); }, 'register function should call register_hook()' : function (test) { @@ -295,8 +295,8 @@ exports.all = { setUp : _set_up, 'register_hook() should register available function' : function (test) { test.expect(3); - test.isNotNull(this.plugin.all); - test.isFunction(this.plugin.all); + test.ok(this.plugin.all); + test.equal('function', typeof this.plugin.all); this.plugin.register(); this.plugin.cfg.relay.all = true; this.plugin.register_hook('rcpt', 'all'); // register() doesn't b/c config is disabled diff --git a/tests/plugins/tls.js b/tests/plugins/tls.js index 3da09e9ca..9926760f1 100644 --- a/tests/plugins/tls.js +++ b/tests/plugins/tls.js @@ -19,28 +19,28 @@ exports.plugin = { setUp : _set_up, 'should have function register' : function (test) { test.expect(2); - test.isNotNull(this.plugin); - test.isFunction(this.plugin.register); + test.ok(this.plugin); + test.equal('function', typeof this.plugin.register); test.done(); }, 'should have function load_tls_ini' : function (test) { test.expect(1); - test.isFunction(this.plugin.load_tls_ini); + test.equal('function', typeof this.plugin.load_tls_ini); test.done(); }, 'should have function upgrade_connection' : function (test) { test.expect(1); - test.isFunction(this.plugin.upgrade_connection); + test.equal('function', typeof this.plugin.upgrade_connection); test.done(); }, 'should have function advertise_starttls' : function (test) { test.expect(1); - test.isFunction(this.plugin.advertise_starttls); + test.equal('function', typeof this.plugin.advertise_starttls); test.done(); }, 'should have function emit_upgrade_msg' : function (test) { test.expect(1); - test.isFunction(this.plugin.emit_upgrade_msg); + test.equal('function', typeof this.plugin.emit_upgrade_msg); test.done(); }, };