diff --git a/.travis.yml b/.travis.yml index 315b759..6895ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: node_js node_js: -- "0.10" -- "0.12" -- "4" - "5" - "6" +- "7" +- "8" +- "9" sudo: false after_success: - "npm run coverage" diff --git a/lib/fs-helpers.js b/lib/fs-helpers.js index 1a8fb90..abd9547 100644 --- a/lib/fs-helpers.js +++ b/lib/fs-helpers.js @@ -42,18 +42,14 @@ var helpers = { * * @param {String} path */ - exists: typeof fs.access === 'function' ? - function (path) { - try { - fs.accessSync(path); - return true; - } catch (err) { - return false; - } - } : - function (path) { - return fs.existsSync(path); - }, + exists: function (path) { + try { + fs.accessSync(path); + return true; + } catch (err) { + return false; + } + }, /** * @param {String} path diff --git a/lib/git-hooks.js b/lib/git-hooks.js index 37c55f1..1f98e63 100644 --- a/lib/git-hooks.js +++ b/lib/git-hooks.js @@ -62,13 +62,7 @@ module.exports = { fsHelpers.makeDir(hooksPath); HOOKS.forEach(function (hookName) { var hookPath = path.resolve(hooksPath, hookName); - try { - fs.writeFileSync(hookPath, hook, {mode: '0777'}); - } catch (e) { - // node 0.8 fallback - fs.writeFileSync(hookPath, hook, 'utf8'); - fs.chmodSync(hookPath, '0777'); - } + fs.writeFileSync(hookPath, hook, {mode: '0777'}); }); }, diff --git a/package.json b/package.json index cf1ec90..8d833ba 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "prepare-commit-msg" ], "engines": { - "node": ">=0.8.x" + "node": ">=5" }, "engine-strict": true, "scripts": { @@ -48,11 +48,11 @@ "lib" ], "devDependencies": { - "chai": "2.3.0", - "istanbul": "0.3.17", - "jscs": "1.13.1", - "jshint": "2.8.0", - "mocha": "2.2.5" + "chai": "4.1.2", + "istanbul": "0.4.5", + "jscs": "2.11.0", + "jshint": "2.9.5", + "mocha": "5.1.1" }, "license": "MIT" } diff --git a/tests/uninstall.test.js b/tests/uninstall.test.js index 56fa421..5856ba7 100644 --- a/tests/uninstall.test.js +++ b/tests/uninstall.test.js @@ -1,5 +1,5 @@ require('chai').should(); -var exec = require('child_process').exec; +var execSync = require('child_process').execSync; var gitHooks = require('../lib/git-hooks'); var fsHelpers = require('../lib/fs-helpers'); @@ -9,14 +9,9 @@ var GIT_HOOKS = GIT_ROOT + 'hooks'; var GIT_HOOKS_OLD = GIT_ROOT + 'hooks.old'; describe('--uninstall', function () { - beforeEach(function (done) { + beforeEach(function () { fsHelpers.makeDir(SANDBOX_PATH); - exec('git init', {cwd: SANDBOX_PATH}, function (err) { - if (err) { - throw err; - } - done(); - }); + execSync('git init', {cwd: SANDBOX_PATH}); }); afterEach(function () {