diff --git a/README.md b/README.md index 583f8c4b2..ba4a89cc7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ var paths = { images: 'client/img/**/*' }; -gulp.task('scripts', function() { +gulp.task('scripts', function () { // Minify and copy all JavaScript (except vendor scripts) return gulp.src(paths.scripts) .pipe(coffee()) @@ -42,7 +42,7 @@ gulp.task('scripts', function() { }); // Copy all static images -gulp.task('images', function() { +gulp.task('images', function () { return gulp.src(paths.images) // Pass in options to the task .pipe(imagemin({optimizationLevel: 5})) diff --git a/docs/API.md b/docs/API.md index 1ad313575..cc09e2efa 100644 --- a/docs/API.md +++ b/docs/API.md @@ -59,7 +59,7 @@ The path (folder) to write files to. Define a task using [Orchestrator]. ```javascript -gulp.task('somename', function() { +gulp.task('somename', function () { // Do stuff }); ``` @@ -74,7 +74,7 @@ Type: `Array` An array of tasks to be executed and completed before your task will run. ```javascript -gulp.task('mytask', ['array', 'of', 'task', 'names'], function() { +gulp.task('mytask', ['array', 'of', 'task', 'names'], function () { // Do stuff }); ``` @@ -93,7 +93,7 @@ Tasks can be made asynchronous if its `fn` does one of the following: ##### Accept a callback ```javascript -gulp.task('somename', function(cb) { +gulp.task('somename', function (cb) { // Do stuff cb(err); }); @@ -102,7 +102,7 @@ gulp.task('somename', function(cb) { ##### Return a stream ```javascript -gulp.task('somename', function() { +gulp.task('somename', function () { var stream = gulp.src('./client/**/*.js') .pipe(minify()) .pipe(gulp.dest('/build')); @@ -115,11 +115,11 @@ gulp.task('somename', function() { ```javascript var Q = require('q'); -gulp.task('somename', function() { +gulp.task('somename', function () { var deferred = Q.defer(); // Do async stuff - setTimeout(function() { + setTimeout(function () { deferred.resolve(); }, 1); @@ -183,7 +183,7 @@ Names of task(s) to run when a file changes, added with `gulp.task()` ```javascript var watcher = gulp.watch('js/**/*.js', ['uglify','reload']); -watcher.on('change', function(event){ +watcher.on('change', function (event) { console.log('File '+event.path+' was '+event.type+', running tasks...'); }); ``` @@ -206,7 +206,7 @@ Type: `Function` Callback to be called on each change. ```javascript -gulp.watch('js/**/*.js', function(event) { +gulp.watch('js/**/*.js', function (event) { console.log('File '+event.path+' was '+event.type+', running tasks...'); }); ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 30bc1433d..4bc4aa1c8 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -17,7 +17,7 @@ npm install --save-dev gulp ```javascript var gulp = require('gulp'); -gulp.task('default', function(){ +gulp.task('default', function () { // place code for your default task here }); ``` diff --git a/docs/recipes/combining-streams-to-handle-errors.md b/docs/recipes/combining-streams-to-handle-errors.md index 713104c9c..c5d07e441 100644 --- a/docs/recipes/combining-streams-to-handle-errors.md +++ b/docs/recipes/combining-streams-to-handle-errors.md @@ -14,7 +14,7 @@ var Combine = require('stream-combiner'); var uglify = require('gulp-uglify'); var gulp = require('gulp'); -gulp.task('test', function() { +gulp.task('test', function () { var combined = Combine( gulp.src('bootstrap/js/*.js'), uglify(), @@ -24,10 +24,10 @@ gulp.task('test', function() { // any errors in the above streams // will get caught by this listener, // instead of being thrown: - combined.on('error', function(err) { + combined.on('error', function (err) { console.warn(err.message) }); return combined; }); -``` \ No newline at end of file +``` diff --git a/docs/recipes/mocha-test-runner-with-gulp.md b/docs/recipes/mocha-test-runner-with-gulp.md index 3753070a2..cb517a111 100644 --- a/docs/recipes/mocha-test-runner-with-gulp.md +++ b/docs/recipes/mocha-test-runner-with-gulp.md @@ -6,7 +6,7 @@ var gulp = require('gulp'); var mocha = require('gulp-mocha'); -gulp.task('tests', function() { +gulp.task('tests', function () { return gulp.src(['test/test-*.js'], { read: false }) .pipe(mocha({ reporter: 'spec', @@ -35,7 +35,7 @@ gulp.task('mocha', function () { .on('error', gutil.log); }); -gulp.watch(['lib/**', 'test/**'], batch(function(events, cb) { +gulp.watch(['lib/**', 'test/**'], batch(function (events, cb) { gulp.run('mocha', cb); })); ``` @@ -56,9 +56,9 @@ gulp.task('mocha', function () { .on('error', gutil.log); }); -gulp.task('watch', function() { +gulp.task('watch', function () { return gulp.src(['lib/**', 'test/**'], { read: false }) - .pipe(watch(function(events, cb) { + .pipe(watch(function (events, cb) { gulp.run('mocha', cb); })); }); diff --git a/docs/recipes/rebuild-only-files-that-change.md b/docs/recipes/rebuild-only-files-that-change.md index 056c8e39c..8f4fc98b6 100644 --- a/docs/recipes/rebuild-only-files-that-change.md +++ b/docs/recipes/rebuild-only-files-that-change.md @@ -7,7 +7,7 @@ var gulp = require('gulp'); var sass = require('gulp-sass'); var watch = require('gulp-watch'); -gulp.task('default', function() { +gulp.task('default', function () { return gulp.src('./sass/*.scss') .pipe(watch()) .pipe(sass()) diff --git a/docs/recipes/running-task-steps-per-folder.md b/docs/recipes/running-task-steps-per-folder.md index 203e950ea..c47609214 100644 --- a/docs/recipes/running-task-steps-per-folder.md +++ b/docs/recipes/running-task-steps-per-folder.md @@ -25,17 +25,17 @@ var uglify = require('gulp-uglify'); var scriptsPath = './src/scripts/'; -function getFolders(dir){ +function getFolders(dir) { return fs.readdirSync(dir) - .filter(function(file){ + .filter(function (file) { return fs.statSync(path.join(dir, file)).isDirectory(); }); } -gulp.task('scripts', function() { +gulp.task('scripts', function () { var folders = getFolders(scriptsPath); - var tasks = folders.map(function(folder) { + var tasks = folders.map(function (folder) { // concat into foldername.js // write to output // minify diff --git a/docs/recipes/sharing-streams-with-stream-factories.md b/docs/recipes/sharing-streams-with-stream-factories.md index c94e6d917..f6ceb0bec 100644 --- a/docs/recipes/sharing-streams-with-stream-factories.md +++ b/docs/recipes/sharing-streams-with-stream-factories.md @@ -16,7 +16,7 @@ var coffee = require('gulp-coffee'); var jshint = require('gulp-jshint'); var stylish = require('jshint-stylish'); -gulp.task('bootstrap', function() { +gulp.task('bootstrap', function () { return gulp.src('bootstrap/js/*.js') .pipe(jshint()) .pipe(jshint.reporter(stylish)) @@ -24,7 +24,7 @@ gulp.task('bootstrap', function() { .pipe(gulp.dest('public/bootstrap')); }); -gulp.task('coffee', function() { +gulp.task('coffee', function () { return gulp.src('lib/js/*.coffee') .pipe(coffee()) .pipe(jshint()) @@ -51,13 +51,13 @@ var jsTransform = lazypipe() .pipe(jshint.reporter, stylish) .pipe(uglify); -gulp.task('bootstrap', function() { +gulp.task('bootstrap', function () { return gulp.src('bootstrap/js/*.js') .pipe(jsTransform()) .pipe(gulp.dest('public/bootstrap')); }); -gulp.task('coffee', function() { +gulp.task('coffee', function () { return gulp.src('lib/js/*.coffee') .pipe(coffee()) .pipe(jsTransform()) @@ -65,4 +65,4 @@ gulp.task('coffee', function() { }); ``` -You can see we split out our javascript pipeline (jshint + uglify) that was being reused in multiple tasks into a factory. These factories can be reused in as many tasks as you want. You can also nest factories and you can chain factories together for great effect. Splitting out each shared pipeline also gives you one central location to modify if you decide to change up your workflow. \ No newline at end of file +You can see we split out our javascript pipeline (jshint + uglify) that was being reused in multiple tasks into a factory. These factories can be reused in as many tasks as you want. You can also nest factories and you can chain factories together for great effect. Splitting out each shared pipeline also gives you one central location to modify if you decide to change up your workflow. diff --git a/docs/recipes/using-multiple-sources-in-one-task.md b/docs/recipes/using-multiple-sources-in-one-task.md index 352a8e9e1..46fcc9af2 100644 --- a/docs/recipes/using-multiple-sources-in-one-task.md +++ b/docs/recipes/using-multiple-sources-in-one-task.md @@ -6,7 +6,7 @@ var gulp = require('gulp'); var es = require('event-stream'); -gulp.task('test', function(cb) { +gulp.task('test', function (cb) { return es.concat( gulp.src('bootstrap/js/*.js') .pipe(gulp.dest('public/bootstrap')), @@ -44,4 +44,4 @@ gulp.task('default', function () { .pipe(concat('result.txt')) .pipe(gulp.dest('build')); }); -``` \ No newline at end of file +``` diff --git a/gulpfile.js b/gulpfile.js index 85467af5d..7d1dfbb62 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,14 +7,14 @@ var jshint = require('gulp-jshint'); var codeFiles = ['**/*.js', '!node_modules/**']; -gulp.task('lint', function(){ +gulp.task('lint', function () { log('Linting Files'); return gulp.src(codeFiles) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter()); }); -gulp.task('watch', function(){ +gulp.task('watch', function () { log('Watching Files'); gulp.watch(codeFiles, ['lint']); }); diff --git a/index.js b/index.js index 128ef39cd..a1dc71204 100644 --- a/index.js +++ b/index.js @@ -6,13 +6,13 @@ var gutil = require('gulp-util'); var deprecated = require('deprecated'); var vfs = require('vinyl-fs'); -function Gulp(){ +function Gulp() { Orchestrator.call(this); } util.inherits(Gulp, Orchestrator); Gulp.prototype.task = Gulp.prototype.add; -Gulp.prototype.run = function(){ +Gulp.prototype.run = function () { // run() is deprecated as of 3.5 and will be removed in 4.0 // use task dependencies instead @@ -32,7 +32,7 @@ Gulp.prototype.watch = function (glob, opt, fn) { // array of tasks given if (Array.isArray(fn)) { - return vfs.watch(glob, opt, function(){ + return vfs.watch(glob, opt, function () { this.start.apply(this, fn); }.bind(this)); } diff --git a/lib/completion.js b/lib/completion.js index d8f93317b..dfa1f8a88 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -3,7 +3,7 @@ var fs = require('fs'); var path = require('path'); -module.exports = function(name) { +module.exports = function (name) { if (typeof name !== 'string') throw new Error('Missing completion type'); var file = path.join(__dirname, '../completion', name); try { diff --git a/lib/taskTree.js b/lib/taskTree.js index f06de7a66..8d6996f16 100644 --- a/lib/taskTree.js +++ b/lib/taskTree.js @@ -1,11 +1,11 @@ 'use strict'; -module.exports = function(tasks) { - return Object.keys(tasks).reduce(function(prev, task) { +module.exports = function (tasks) { + return Object.keys(tasks).reduce(function (prev, task) { prev.nodes.push({ label: task, nodes: tasks[task].dep }); return prev; }, {nodes: []}); -}; \ No newline at end of file +}; diff --git a/test/dest.js b/test/dest.js index 86a764fdc..60c408720 100644 --- a/test/dest.js +++ b/test/dest.js @@ -10,25 +10,25 @@ require('mocha'); var outpath = join(__dirname, "./out-fixtures"); -describe('gulp output stream', function() { - describe('dest()', function() { +describe('gulp output stream', function () { + describe('dest()', function () { beforeEach(rimraf.bind(null, outpath)); afterEach(rimraf.bind(null, outpath)); - it('should return a stream', function(done) { + it('should return a stream', function (done) { var stream = gulp.dest(join(__dirname, "./fixtures/")); should.exist(stream); should.exist(stream.on); done(); }); - it('should return a output stream that writes files', function(done) { + it('should return a output stream that writes files', function (done) { var instream = gulp.src(join(__dirname, "./fixtures/**/*.txt")); var outstream = gulp.dest(outpath); instream.pipe(outstream); outstream.on('error', done); - outstream.on('data', function(file) { + outstream.on('data', function (file) { // data should be re-emitted right should.exist(file); should.exist(file.path); @@ -36,8 +36,8 @@ describe('gulp output stream', function() { join(file.path,'').should.equal(join(outpath, "./copy/example.txt")); String(file.contents).should.equal("this is a test"); }); - outstream.on('end', function() { - fs.readFile(join(outpath, "copy", "example.txt"), function(err, contents){ + outstream.on('end', function () { + fs.readFile(join(outpath, "copy", "example.txt"), function (err, contents) { should.not.exist(err); should.exist(contents); String(contents).should.equal("this is a test"); @@ -46,21 +46,21 @@ describe('gulp output stream', function() { }); }); - it('should return a output stream that does not write non-read files', function(done) { + it('should return a output stream that does not write non-read files', function (done) { var instream = gulp.src(join(__dirname, "./fixtures/**/*.txt"), {read:false}); var outstream = gulp.dest(outpath); instream.pipe(outstream); outstream.on('error', done); - outstream.on('data', function(file) { + outstream.on('data', function (file) { // data should be re-emitted right should.exist(file); should.exist(file.path); should.not.exist(file.contents); join(file.path,'').should.equal(join(outpath, "./copy/example.txt")); }); - outstream.on('end', function() { - fs.readFile(join(outpath, "copy", "example.txt"), function(err, contents){ + outstream.on('end', function () { + fs.readFile(join(outpath, "copy", "example.txt"), function (err, contents) { should.exist(err); should.not.exist(contents); done(); @@ -68,20 +68,20 @@ describe('gulp output stream', function() { }); }); - it('should return a output stream that writes streaming files', function(done) { + it('should return a output stream that writes streaming files', function (done) { var instream = gulp.src(join(__dirname, "./fixtures/**/*.txt"), {buffer:false}); var outstream = instream.pipe(gulp.dest(outpath)); outstream.on('error', done); - outstream.on('data', function(file) { + outstream.on('data', function (file) { // data should be re-emitted right should.exist(file); should.exist(file.path); should.exist(file.contents); join(file.path,'').should.equal(join(outpath, "./copy/example.txt")); }); - outstream.on('end', function() { - fs.readFile(join(outpath, "copy", "example.txt"), function(err, contents){ + outstream.on('end', function () { + fs.readFile(join(outpath, "copy", "example.txt"), function (err, contents) { should.not.exist(err); should.exist(contents); String(contents).should.equal("this is a test"); @@ -90,19 +90,19 @@ describe('gulp output stream', function() { }); }); - it('should return a output stream that writes streaming files into new directories', function(done) { + it('should return a output stream that writes streaming files into new directories', function (done) { testWriteDir({}, done); }); - it('should return a output stream that writes streaming files into new directories (buffer: false)', function(done) { + it('should return a output stream that writes streaming files into new directories (buffer: false)', function (done) { testWriteDir({buffer: false}, done); }); - it('should return a output stream that writes streaming files into new directories (read: false)', function(done) { + it('should return a output stream that writes streaming files into new directories (read: false)', function (done) { testWriteDir({read: false}, done); }); - it('should return a output stream that writes streaming files into new directories (read: false, buffer: false)', function(done) { + it('should return a output stream that writes streaming files into new directories (read: false, buffer: false)', function (done) { testWriteDir({buffer: false, read: false}, done); }); @@ -111,14 +111,14 @@ describe('gulp output stream', function() { var outstream = instream.pipe(gulp.dest(outpath)); outstream.on('error', done); - outstream.on('data', function(file) { + outstream.on('data', function (file) { // data should be re-emitted right should.exist(file); should.exist(file.path); join(file.path,'').should.equal(join(outpath, "./stuff")); }); - outstream.on('end', function() { - fs.exists(join(outpath, "stuff"), function(exists) { + outstream.on('end', function () { + fs.exists(join(outpath, "stuff"), function (exists) { /* stinks that ok is an expression instead of a function call */ /* jshint expr: true */ should(exists).be.ok; diff --git a/test/src.js b/test/src.js index 8d93ed0e6..4511ff236 100644 --- a/test/src.js +++ b/test/src.js @@ -6,30 +6,30 @@ var join = require('path').join; require('mocha'); -describe('gulp input stream', function() { - describe('src()', function() { - it('should return a stream', function(done) { +describe('gulp input stream', function () { + describe('src()', function () { + it('should return a stream', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/*.coffee")); should.exist(stream); should.exist(stream.on); done(); }); - it('should return a input stream from a flat glob', function(done) { + it('should return a input stream from a flat glob', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/*.coffee")); stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); should.exist(file.contents); join(file.path,'').should.equal(join(__dirname, "./fixtures/test.coffee")); String(file.contents).should.equal("this is a test"); }); - stream.on('end', function() { + stream.on('end', function () { done(); }); }); - it('should return a input stream for multiple globs', function(done) { + it('should return a input stream for multiple globs', function (done) { var globArray = [ join(__dirname, "./fixtures/stuff/run.dmc"), join(__dirname, "./fixtures/stuff/test.dmc") @@ -38,12 +38,12 @@ describe('gulp input stream', function() { var files = []; stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); files.push(file); }); - stream.on('end', function() { + stream.on('end', function () { files.length.should.equal(2); files[0].path.should.equal(globArray[0]); files[1].path.should.equal(globArray[1]); @@ -51,7 +51,7 @@ describe('gulp input stream', function() { }); }); - it('should return a input stream for multiple globs, with negation', function(done) { + it('should return a input stream for multiple globs, with negation', function (done) { var expectedPath = join(__dirname, "./fixtures/stuff/run.dmc"); var globArray = [ join(__dirname, "./fixtures/stuff/*.dmc"), @@ -61,19 +61,19 @@ describe('gulp input stream', function() { var files = []; stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); files.push(file); }); - stream.on('end', function() { + stream.on('end', function () { files.length.should.equal(1); files[0].path.should.equal(expectedPath); done(); }); }); - it('should return a input stream for multiple globs, with negation', function(done) { + it('should return a input stream for multiple globs, with negation', function (done) { var expectedPath = join(__dirname, "./fixtures/stuff/run.dmc"); var globArray = [ join(__dirname, "./fixtures/stuff/run.dmc"), @@ -83,81 +83,81 @@ describe('gulp input stream', function() { var files = []; stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); files.push(file); }); - stream.on('end', function() { + stream.on('end', function () { files.length.should.equal(1); files[0].path.should.equal(expectedPath); done(); }); }); - it('should return a input stream with no contents when read is false', function(done) { + it('should return a input stream with no contents when read is false', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/*.coffee"), {read: false}); stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); should.not.exist(file.contents); join(file.path,'').should.equal(join(__dirname, "./fixtures/test.coffee")); }); - stream.on('end', function() { + stream.on('end', function () { done(); }); }); - it('should return a input stream with contents as stream when buffer is false', function(done) { + it('should return a input stream with contents as stream when buffer is false', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/*.coffee"), {buffer: false}); stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); should.exist(file.contents); var buf = ""; - file.contents.on('data', function(d){ + file.contents.on('data', function (d) { buf += d; }); - file.contents.on('end', function(){ + file.contents.on('end', function () { buf.should.equal("this is a test"); done(); }); join(file.path,'').should.equal(join(__dirname, "./fixtures/test.coffee")); }); }); - it('should return a input stream from a deep glob', function(done) { + it('should return a input stream from a deep glob', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/**/*.jade")); stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { should.exist(file); should.exist(file.path); should.exist(file.contents); join(file.path,'').should.equal(join(__dirname, "./fixtures/test/run.jade")); String(file.contents).should.equal("test template"); }); - stream.on('end', function() { + stream.on('end', function () { done(); }); }); - it('should return a input stream from a deeper glob', function(done) { + it('should return a input stream from a deeper glob', function (done) { var stream = gulp.src(join(__dirname, "./fixtures/**/*.dmc")); var a = 0; stream.on('error', done); - stream.on('data', function() { + stream.on('data', function () { ++a; }); - stream.on('end', function() { + stream.on('end', function () { a.should.equal(2); done(); }); }); - it('should return a file stream from a flat path', function(done) { + it('should return a file stream from a flat path', function (done) { var a = 0; var stream = gulp.src(join(__dirname, "./fixtures/test.coffee")); stream.on('error', done); - stream.on('data', function(file) { + stream.on('data', function (file) { ++a; should.exist(file); should.exist(file.path); @@ -165,7 +165,7 @@ describe('gulp input stream', function() { join(file.path,'').should.equal(join(__dirname, "./fixtures/test.coffee")); String(file.contents).should.equal("this is a test"); }); - stream.on('end', function() { + stream.on('end', function () { a.should.equal(1); done(); }); diff --git a/test/taskTree.js b/test/taskTree.js index 52f8c57b8..9ea0e58e4 100644 --- a/test/taskTree.js +++ b/test/taskTree.js @@ -5,8 +5,8 @@ var should = require('should'); require('mocha'); -describe('taskTree()', function() { - it('should form a tree properly', function(done){ +describe('taskTree()', function () { + it('should form a tree properly', function (done) { should.exist(taskTree); // lol shutup jshint var tasks = { diff --git a/test/tasks.js b/test/tasks.js index 5dfb62d71..b52f441aa 100644 --- a/test/tasks.js +++ b/test/tasks.js @@ -5,11 +5,11 @@ var Q = require('q'); var should = require('should'); require('mocha'); -describe('gulp tasks', function() { - describe('task()', function() { - it('should define a task', function(done) { +describe('gulp tasks', function () { + describe('task()', function () { + it('should define a task', function (done) { var fn; - fn = function() {}; + fn = function () {}; gulp.task('test', fn); should.exist(gulp.tasks.test); gulp.tasks.test.fn.should.equal(fn); @@ -17,15 +17,15 @@ describe('gulp tasks', function() { done(); }); }); - describe('run()', function() { - it('should run multiple tasks', function(done) { + describe('run()', function () { + it('should run multiple tasks', function (done) { var a, fn, fn2; a = 0; - fn = function() { + fn = function () { this.should.equal(gulp); ++a; }; - fn2 = function() { + fn2 = function () { this.should.equal(gulp); ++a; }; @@ -36,14 +36,14 @@ describe('gulp tasks', function() { gulp.reset(); done(); }); - it('should run all tasks when call run() multiple times', function(done) { + it('should run all tasks when call run() multiple times', function (done) { var a, fn, fn2; a = 0; - fn = function() { + fn = function () { this.should.equal(gulp); ++a; }; - fn2 = function() { + fn2 = function () { this.should.equal(gulp); ++a; }; @@ -55,10 +55,10 @@ describe('gulp tasks', function() { gulp.reset(); done(); }); - it('should run all async promise tasks', function(done) { + it('should run all async promise tasks', function (done) { var a, fn, fn2; a = 0; - fn = function() { + fn = function () { var deferred = Q.defer(); setTimeout(function () { ++a; @@ -66,7 +66,7 @@ describe('gulp tasks', function() { },1); return deferred.promise; }; - fn2 = function() { + fn2 = function () { var deferred = Q.defer(); setTimeout(function () { ++a; @@ -85,16 +85,16 @@ describe('gulp tasks', function() { }); gulp.isRunning.should.equal(true); }); - it('should run all async callback tasks', function(done) { + it('should run all async callback tasks', function (done) { var a, fn, fn2; a = 0; - fn = function(cb) { + fn = function (cb) { setTimeout(function () { ++a; cb(null); },1); }; - fn2 = function(cb) { + fn2 = function (cb) { setTimeout(function () { ++a; cb(null); @@ -111,8 +111,8 @@ describe('gulp tasks', function() { }); gulp.isRunning.should.equal(true); }); - it('should emit task_not_found and throw an error when task is not defined', function(done) { - gulp.on('task_not_found', function(err){ + it('should emit task_not_found and throw an error when task is not defined', function (done) { + gulp.on('task_not_found', function (err) { should.exist(err); should.exist(err.task); err.task.should.equal('test'); @@ -125,10 +125,10 @@ describe('gulp tasks', function() { should.exist(err); } }); - it('should run task scoped to gulp', function(done) { + it('should run task scoped to gulp', function (done) { var a, fn; a = 0; - fn = function() { + fn = function () { this.should.equal(gulp); ++a; }; @@ -139,10 +139,10 @@ describe('gulp tasks', function() { gulp.reset(); done(); }); - it('should run default task scoped to gulp', function(done) { + it('should run default task scoped to gulp', function (done) { var a, fn; a = 0; - fn = function() { + fn = function () { this.should.equal(gulp); ++a; }; diff --git a/test/watch.js b/test/watch.js index 19c5abc5a..e155da742 100644 --- a/test/watch.js +++ b/test/watch.js @@ -11,8 +11,8 @@ require('mocha'); var outpath = path.join(__dirname, "./out-fixtures"); -describe('gulp', function() { - describe('watch()', function() { +describe('gulp', function () { + describe('watch()', function () { beforeEach(rimraf.bind(null, outpath)); beforeEach(mkdirp.bind(null, outpath)); afterEach(rimraf.bind(null, outpath)); @@ -21,12 +21,12 @@ describe('gulp', function() { var writeTimeout = 125; // Wait for it to get to the filesystem var writeFileWait = function (name, content, cb) { - if (!cb) cb = function(){}; + if (!cb) cb = function () {}; setTimeout(function () { fs.writeFile(name, content, cb); }, writeTimeout); }; - it('should call the function when file changes: no options', function(done) { + it('should call the function when file changes: no options', function (done) { // arrange var tempFile = path.join(outpath, 'watch-func.txt'); @@ -48,7 +48,7 @@ describe('gulp', function() { }); }); - it('should call the function when file changes: w/ options', function(done) { + it('should call the function when file changes: w/ options', function (done) { // arrange var tempFile = path.join(outpath, 'watch-func-options.txt'); fs.writeFile(tempFile, tempFileContent, function () { @@ -69,7 +69,7 @@ describe('gulp', function() { }); }); - it('should run many tasks: w/ options', function(done) { + it('should run many tasks: w/ options', function (done) { // arrange var tempFile = path.join(outpath, 'watch-task-options.txt'); var task1 = 'task1';