Skip to content

Commit

Permalink
chore(project): remove grunt + jshint
Browse files Browse the repository at this point in the history
* use npm-run-all to execute build steps
* use eslint for linting
  • Loading branch information
nikku committed Nov 13, 2017
1 parent 08141de commit 0fed147
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/fixtures
test/integration
30 changes: 30 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"rules": {
"keyword-spacing": [ 2 ],
"object-curly-spacing": [ 2, "always"],
"space-before-blocks": [ 2, "always"],
"indent": [ 2, 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } } ],
"no-unused-vars": [ 2, { "args": "none" } ],
"space-before-function-paren": [ 2, "never" ],
"quotes": [ 2, "single" ],
"semi": [ 2, "always" ],
"no-console": 0,
"mocha/no-exclusive-tests": 2
},
"env": {
"node": true
},
"extends": "eslint:recommended",
"plugins": [
"mocha"
],
"globals": {
"expect": false,
"it": false,
"describe": false,
"beforeEach": true,
"afterEach": true,
"before": true,
"after": true
}
}
24 changes: 0 additions & 24 deletions .jshintrc

This file was deleted.

1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/.*
test/
example/
Gruntfile.js
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Some things that make it easier for us to accept your pull requests
* single-quotes
* ...
* The code is tested
* The `grunt` build passes (executes tests + linting)
* The `npm run all` build passes (executes tests + linting)
* The work is combined into a single commit
* The commit messages adhere to our [guideline](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y)

Expand All @@ -42,4 +42,4 @@ When merging, try to do it manually (rebase on current master). This avoids merg

### Release the project

To release execute `grunt release(:major|:minor|:patch)`. Respect [semantic versioning](http://semver.org/) and choose correct next version based on latest changes.
To release execute `npm run release`. Respect [semantic versioning](http://semver.org/) and choose correct next version based on latest changes.
50 changes: 0 additions & 50 deletions Gruntfile.js

This file was deleted.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
],
"version": "5.1.1",
"scripts": {
"all": "grunt",
"test": "grunt test"
"all": "run-s lint test",
"lint": "eslint .",
"test": "mocha --exit -r test/expect test/spec/*.js",
"release": "np --no-publish"
},
"authors": [
"Nico Rehwaldt <[email protected]>",
Expand All @@ -36,17 +38,15 @@
"browser-unpack": "^1.1.1",
"browserify": "^14.5.0",
"chai": "^4.1.2",
"grunt": "~1.0.1",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.3",
"grunt-mocha-test": "^0.12.7",
"grunt-release": "^0.13.0",
"eslint": "^4.11.0",
"eslint-plugin-mocha": "^4.11.0",
"jasmine-core": "^2.4.1",
"karma": "^1.7.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"load-grunt-tasks": "^3.4.0",
"mocha": "^4.0.1",
"np": "^2.16.1",
"npm-run-all": "^4.1.2",
"resolve": "^1.1.6",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ module.exports = function() {

karma.set(opts);
};
}
};
10 changes: 7 additions & 3 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Runner.prototype.stop = function() {
this.stopFn = null;
};

Runner.prototype.stopAfter = function (ms) {
Runner.prototype.stopAfter = function(ms) {
if (this.stopTimeout) clearTimeout(this.stopTimeout);
return this.stopTimeout = setTimeout(this.stop.bind(this), ms);
};
Expand Down Expand Up @@ -75,7 +75,7 @@ Runner.prototype.configure = function(configFile, config) {
};

Runner.prototype.plugin = function() {
return {'framework:runner': ['factory', this.factory()]};
return { 'framework:runner': ['factory', this.factory()] };
};

Runner.prototype.factory = function() {
Expand All @@ -86,8 +86,12 @@ Runner.prototype.factory = function() {
this.reset();
done();
}.bind(this));

emitter.once('run_start', function() {
this.stopFn = process.listeners('SIGINT')[0];
// find karma runner SIGINT handler
this.stopFn = process.listeners('SIGINT').filter(function(fn, idx) {
return /disconnectBrowsers/.test(fn.toString());
})[0];
}.bind(this));
for (var k in this.queuedListeners) this.listen(k);
this.emit('framework');
Expand Down
1 change: 0 additions & 1 deletion test/spec/browserifySpec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var browserify = require('browserify');
var path = require('path');
var vm = require('vm');

function delay(fn, time) {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/integrationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function triggerRun(configFile, done) {
}


describe.only('karma-browserify', function() {
describe('karma-browserify', function() {

var runner,
watchSpy;
Expand Down
10 changes: 5 additions & 5 deletions test/spec/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ describe('karma-browserify', function() {
// then

// bundle got created
expect(bundleFile.bundled).to.contain("module.exports.text = '<' + \"HALLO\" + '>'");
expect(bundleFile.bundled).to.contain('module.exports.text = \'<\' + "HALLO" + \'>\'');

done();
});
Expand All @@ -555,7 +555,7 @@ describe('karma-browserify', function() {
// then

// bundle got created
expect(bundleFile.bundled).to.contain("module.exports.text = '<' + \"HALLO\" + '>'");
expect(bundleFile.bundled).to.contain('module.exports.text = \'<\' + "HALLO" + \'>\'');

done();
});
Expand Down Expand Up @@ -656,7 +656,7 @@ describe('karma-browserify', function() {
configure: function(bundle) {

// after first bundle
bundle.once('bundled', function (err) {
bundle.once('bundled', function(err) {

// fail if there was an error
if (err) {
Expand All @@ -669,7 +669,7 @@ describe('karma-browserify', function() {
return done(err);
}

expect(bundleFile.bundled).to.contain("module.exports.text = '<' + \"HALLO\" + '>'");
expect(bundleFile.bundled).to.contain('module.exports.text = \'<\' + "HALLO" + \'>\'');
done();
});

Expand All @@ -695,7 +695,7 @@ describe('karma-browserify', function() {
// Hook into bundler/pipeline events for success/error
configure: function(bundle) {
// After first bundle
bundle.once('bundled', function (err) {
bundle.once('bundled', function(err) {
// Fail if there was an error
if (err) {
return done(err);
Expand Down

0 comments on commit 0fed147

Please sign in to comment.