gulp-newer
Advanced tools
Comparing version 0.5.1 to 0.5.2
17
index.js
@@ -11,2 +11,4 @@ var Transform = require('stream').Transform; | ||
var PLUGIN_NAME = 'gulp-newer'; | ||
function Newer(options) { | ||
@@ -16,3 +18,4 @@ Transform.call(this, {objectMode: true}); | ||
if (!options) { | ||
throw new PluginError('Requires a dest string or options object'); | ||
throw new PluginError(PLUGIN_NAME, | ||
'Requires a dest string or options object'); | ||
} | ||
@@ -23,11 +26,11 @@ | ||
} else if (typeof options.dest !== 'string') { | ||
throw new PluginError('Requires a dest string'); | ||
throw new PluginError(PLUGIN_NAME, 'Requires a dest string'); | ||
} | ||
if (options.ext && typeof options.ext !== 'string') { | ||
throw new PluginError('Requires ext to be a string'); | ||
throw new PluginError(PLUGIN_NAME, 'Requires ext to be a string'); | ||
} | ||
if (options.map && typeof options.map !== 'function') { | ||
throw new PluginError('Requires map to be a function'); | ||
throw new PluginError(PLUGIN_NAME, 'Requires map to be a function'); | ||
} | ||
@@ -88,3 +91,3 @@ | ||
if (!srcFile || !srcFile.stat) { | ||
done(new PluginError('gulp-newer', 'Expected a source file with stats')); | ||
done(new PluginError(PLUGIN_NAME, 'Expected a source file with stats')); | ||
return; | ||
@@ -141,3 +144,3 @@ } | ||
done(); | ||
}, done); | ||
}).fail(done).end(); | ||
@@ -159,3 +162,3 @@ }; | ||
* Only pass through source files that are newer than the provided destination. | ||
* @param {string} dest Path to destination directory or file. | ||
* @param {Object} options An options object or path to destination. | ||
* @return {Newer} A transform stream. | ||
@@ -162,0 +165,0 @@ */ |
{ | ||
"name": "gulp-newer", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Only pass through newer source files", | ||
@@ -26,15 +26,18 @@ "homepage": "https://github.com/tschaub/gulp-newer", | ||
"scripts": { | ||
"test": "node tasks.js lint test" | ||
"pretest": "eslint index.js spec.js", | ||
"test": "mocha spec.js" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.4.0", | ||
"eslint": "^1.7.3", | ||
"eslint-config-tschaub": "^2.0.0", | ||
"gulp": "^3.9.0", | ||
"jshint": "~2.5.10", | ||
"mocha": "~2.0.1", | ||
"gulp": "~3.8.10", | ||
"chai": "~1.10.0", | ||
"mock-fs": "~2.3.2" | ||
"mocha": "^2.3.3", | ||
"mock-fs": "^3.4.0" | ||
}, | ||
"dependencies": { | ||
"kew": "~0.3.1", | ||
"gulp-util": "~3.0.1" | ||
"kew": "^0.7.0", | ||
"gulp-util": "^3.0.7" | ||
} | ||
} |
36
spec.js
@@ -0,1 +1,3 @@ | ||
/* eslint-env mocha */ | ||
var Transform = require('stream').Transform; | ||
@@ -11,10 +13,7 @@ var fs = require('fs'); | ||
chai.config.includeStack = true; | ||
/** @type {boolean} */ | ||
chai.Assertion.includeStack = true; | ||
var File = gutil.File; | ||
var assert = chai.assert; | ||
/** | ||
@@ -633,5 +632,34 @@ * Test utility function. Create File instances for each of the provided paths | ||
}); | ||
}); | ||
describe('reports errors', function() { | ||
beforeEach(function() { | ||
mock({ | ||
'q': mock.file({ | ||
mtime: new Date(100) | ||
}), | ||
dest: {} | ||
}); | ||
}); | ||
afterEach(mock.restore); | ||
it('in "data" handlers', function(done) { | ||
var stream = newer('dest'); | ||
var err = new Error('test'); | ||
stream.on('data', function() { | ||
throw err; | ||
}); | ||
stream.on('error', function(caught) { | ||
assert.equal(caught, err); | ||
done(); | ||
}); | ||
write(stream, ['q']); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23103
7
7
668
+ Addedkew@0.7.0(transitive)
- Removedkew@0.3.4(transitive)
Updatedgulp-util@^3.0.7
Updatedkew@^0.7.0