hostparty
Version:
Programmatic and CLI editing for OS hosts file
74 lines (59 loc) • 2.15 kB
JavaScript
(()=>{
'use strict';
module.exports = (grunt)=>{
var _ = require('lodash'),
util = require('util'),
path = require('path'),
fs = require('fs').promises;
grunt.initConfig({
// apply jslinting to the following
jshint: {
all: ['*.js', 'lib/**/*.js', 'tests/**/*.js'],
options: {
// change the reporter to one that outputs nicely
reporter: require('jshint-stylish'),
// all rules come from .jshintrc
jshintrc: true
}
},
// tasks that are run when grunt is in under `watch` mode
watch: {
// watch js files for changes
scripts: {
files: ['*.js', 'lib/*.js', 'routes/**/*.js', 'tests/**/*.js', 'tests/etc/hosts.test.orig'],
tasks: ['jshint', 'simplemocha']
}
},
// setup mocha
simplemocha: {
options: {
globals: ['expect'],
timeout: 10000,
ignoreLeaks: false,
useColors: false,
fullTrace: true,
ui: 'bdd',
reporter: 'spec'
},
// all tests
all: {
src: [
// do environment tests first
'tests/**/*.js'
]
}
}
});
// mocha
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
// dev will start a watcher
grunt.registerTask('dev', [
'test',
'watch'
]);
// dev will start a watcher on changes to js files/test data and run tests and linter
grunt.registerTask('test', 'simplemocha');
};
})();