From 52c3cad218dbea789464dfde7b48e2105f317fcc Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 22 Jun 2016 17:37:54 -0700 Subject: [PATCH] Fix: Make linting pass & add pretest hook --- package.json | 1 + test/fixtures/taskTree/aliasNested.js | 46 +++++++++++++-------------- test/fixtures/taskTree/aliasSimple.js | 12 +++---- test/integration.js | 9 ++++-- test/task.js | 4 +-- 5 files changed, 39 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index c4249b6..f936849 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ ], "scripts": { "lint": "eslint . && jscs index.js test/", + "pretest": "npm run lint", "test": "mocha --async-only", "cover": "istanbul cover _mocha --report lcovonly", "coveralls": "npm run cover && istanbul-coveralls" diff --git a/test/fixtures/taskTree/aliasNested.js b/test/fixtures/taskTree/aliasNested.js index da786ae..6451745 100644 --- a/test/fixtures/taskTree/aliasNested.js +++ b/test/fixtures/taskTree/aliasNested.js @@ -6,22 +6,22 @@ module.exports = { { label: 'noop', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn1', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn2', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn3', type: 'task', - nodes: [] + nodes: [], }, { label: 'ser', @@ -35,31 +35,31 @@ module.exports = { { label: 'noop', type: 'function', - nodes: [] + nodes: [], }, { label: '', type: 'function', - nodes: [] + nodes: [], }, { label: 'fn1', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn2', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn3', type: 'task', - nodes: [] - } - ] - } - ] + nodes: [], + }, + ], + }, + ], }, { label: 'par', @@ -73,31 +73,31 @@ module.exports = { { label: 'noop', type: 'function', - nodes: [] + nodes: [], }, { label: '', type: 'function', - nodes: [] + nodes: [], }, { label: 'fn1', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn2', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn3', type: 'task', - nodes: [] - } - ] - } - ] - } + nodes: [], + }, + ], + }, + ], + }, ], }; diff --git a/test/fixtures/taskTree/aliasSimple.js b/test/fixtures/taskTree/aliasSimple.js index 2489ab3..ae7df9b 100644 --- a/test/fixtures/taskTree/aliasSimple.js +++ b/test/fixtures/taskTree/aliasSimple.js @@ -6,27 +6,27 @@ module.exports = { { label: 'noop', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn1', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn2', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn3', type: 'task', - nodes: [] + nodes: [], }, { label: 'fn4', type: 'task', - nodes: [] - } + nodes: [], + }, ], }; diff --git a/test/integration.js b/test/integration.js index cdbbb9e..12b6ff8 100644 --- a/test/integration.js +++ b/test/integration.js @@ -110,6 +110,7 @@ describe('integrations', function() { it('can use lastRun with vinyl.src `since` option', function(done) { var count = 0; + var filepath = path.join(__dirname, './fixtures/tmp/testMore.js'); function setup() { return vinyl.src('./fixtures/test*.js', { cwd: __dirname }) @@ -127,7 +128,11 @@ describe('integrations', function() { } function userEdit(cb) { - fs.appendFile(path.join(__dirname, './fixtures/tmp/testMore.js'), ' ', cb); + fs.appendFile(filepath, ' ', cb); + } + + function cleanup(cb) { + fs.unlink(filepath, cb); } function countEditedFiles() { @@ -138,7 +143,7 @@ describe('integrations', function() { })); } - taker.series(setup, 'build', userWait, userEdit, countEditedFiles, function(cb) { + taker.series(setup, 'build', userWait, userEdit, countEditedFiles, cleanup, function(cb) { expect(count).toEqual(1); cb(); })(done); diff --git a/test/task.js b/test/task.js index 57e9abd..a8aa566 100644 --- a/test/task.js +++ b/test/task.js @@ -117,7 +117,7 @@ describe('task', function() { }); taker.parallel('foo', 'bar', function(cb) { - setTimeout(function(){ + setTimeout(function() { expect(count).toEqual(4); cb(); }, 500); @@ -149,7 +149,7 @@ describe('task', function() { }); taker.series('bar', function(cb) { - setTimeout(function(){ + setTimeout(function() { expect(count).toEqual(6); cb(); }, 500);