Skip to content

Commit

Permalink
Merge pull request #70 from bammoo/patch-1
Browse files Browse the repository at this point in the history
Check null before process file
  • Loading branch information
w0rm committed Feb 6, 2016
2 parents 8414a14 + 282444b commit 2c0a800
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ module.exports = function (processors, options) {

stream._transform = function (file, encoding, cb) {

if (file.isNull()) {
return cb(null, file)
}

if (file.isStream()) {
return handleError('Streams are not supported!')
}
Expand Down
16 changes: 16 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ var postcss = require('./index')
var proxyquire = require('proxyquire')
var sinon = require('sinon')

it('should pass file when it isNull()', function (cb) {
var stream = postcss([ doubler ])
var emptyFile = {
isNull: function () { return true }
}

stream.once('data', function (data) {
assert.equal(data, emptyFile)
cb()
})

stream.write(emptyFile)

stream.end()
})

it('should transform css with multiple processors', function (cb) {

var stream = postcss(
Expand Down

0 comments on commit 2c0a800

Please sign in to comment.