Skip to content

Commit 5951059

Browse files
rjmunrotarmolov
authored andcommitted
Upgrade dev dependencies in package.json (#55)
* Upgrade dev dependency chai * Upgrade dev dependency istanbul * Upgrade dev dependency jshint * Upgrade dev dependency mocha * Upgrade dev dependency jscs But stick with a 2.x.x branch as upgrading to 3.x.x broke things. * Only support node 5 and later Based on: https://github.com/nodejs/Release#release-schedule * Simplify tests using execSync Now that we are on node 5 or later * Remove polyfill code for old node JS versions
1 parent e83af69 commit 5951059

File tree

5 files changed

+21
-36
lines changed

5 files changed

+21
-36
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
- "0.12"
5-
- "4"
63
- "5"
74
- "6"
5+
- "7"
6+
- "8"
7+
- "9"
88
sudo: false
99
after_success:
1010
- "npm run coverage"

lib/fs-helpers.js

+8-12
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,14 @@ var helpers = {
4242
*
4343
* @param {String} path
4444
*/
45-
exists: typeof fs.access === 'function' ?
46-
function (path) {
47-
try {
48-
fs.accessSync(path);
49-
return true;
50-
} catch (err) {
51-
return false;
52-
}
53-
} :
54-
function (path) {
55-
return fs.existsSync(path);
56-
},
45+
exists: function (path) {
46+
try {
47+
fs.accessSync(path);
48+
return true;
49+
} catch (err) {
50+
return false;
51+
}
52+
},
5753

5854
/**
5955
* @param {String} path

lib/git-hooks.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@ module.exports = {
6262
fsHelpers.makeDir(hooksPath);
6363
HOOKS.forEach(function (hookName) {
6464
var hookPath = path.resolve(hooksPath, hookName);
65-
try {
66-
fs.writeFileSync(hookPath, hook, {mode: '0777'});
67-
} catch (e) {
68-
// node 0.8 fallback
69-
fs.writeFileSync(hookPath, hook, 'utf8');
70-
fs.chmodSync(hookPath, '0777');
71-
}
65+
fs.writeFileSync(hookPath, hook, {mode: '0777'});
7266
});
7367
},
7468

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"prepare-commit-msg"
3333
],
3434
"engines": {
35-
"node": ">=0.8.x"
35+
"node": ">=5"
3636
},
3737
"engine-strict": true,
3838
"scripts": {
@@ -48,11 +48,11 @@
4848
"lib"
4949
],
5050
"devDependencies": {
51-
"chai": "2.3.0",
52-
"istanbul": "0.3.17",
53-
"jscs": "1.13.1",
54-
"jshint": "2.8.0",
55-
"mocha": "2.2.5"
51+
"chai": "4.1.2",
52+
"istanbul": "0.4.5",
53+
"jscs": "2.11.0",
54+
"jshint": "2.9.5",
55+
"mocha": "5.1.1"
5656
},
5757
"license": "MIT"
5858
}

tests/uninstall.test.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('chai').should();
2-
var exec = require('child_process').exec;
2+
var execSync = require('child_process').execSync;
33
var gitHooks = require('../lib/git-hooks');
44
var fsHelpers = require('../lib/fs-helpers');
55

@@ -9,14 +9,9 @@ var GIT_HOOKS = GIT_ROOT + 'hooks';
99
var GIT_HOOKS_OLD = GIT_ROOT + 'hooks.old';
1010

1111
describe('--uninstall', function () {
12-
beforeEach(function (done) {
12+
beforeEach(function () {
1313
fsHelpers.makeDir(SANDBOX_PATH);
14-
exec('git init', {cwd: SANDBOX_PATH}, function (err) {
15-
if (err) {
16-
throw err;
17-
}
18-
done();
19-
});
14+
execSync('git init', {cwd: SANDBOX_PATH});
2015
});
2116

2217
afterEach(function () {

0 commit comments

Comments
 (0)