Skip to content

Commit

Permalink
add tests for passed options to gulp error
Browse files Browse the repository at this point in the history
  • Loading branch information
Termina1 committed May 1, 2016
1 parent b69b793 commit 716822c
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ it('should pass file when it isNull()', function (cb) {
assert.equal(data, emptyFile)
cb()
})

stream.write(emptyFile)

stream.end()
})

Expand Down Expand Up @@ -53,17 +53,45 @@ it('should correctly wrap postcss errors', function (cb) {
stream.on('error', function (err) {
assert.ok(err instanceof gutil.PluginError)
assert.equal(err.plugin, 'gulp-postcss')
assert.equal(err.showStack, false)
assert.equal(err.fileName, "testpath")
cb()
})

stream.write(new gutil.File({
contents: new Buffer('a {')
contents: new Buffer('a {'),
path: "testpath"
}))

stream.end()

})

it('should respond with error on stream files', function (cb) {

var stream = postcss([ doubler ])

stream.on('error', function (err) {
assert.ok(err instanceof gutil.PluginError)
assert.equal(err.plugin, 'gulp-postcss')
console.log(err)
assert.equal(err.showStack, true)
assert.equal(err.fileName, "testpath")
cb()
})

var streamFile = {
isStream: function () { return true },
isNull: function() { return false },
path: "testpath"
};

stream.write(streamFile)

stream.end()

})


it('should throw error if processors are not provided', function (cb) {
assert.throws( function () { postcss() }, gutil.PluginError )
Expand Down

0 comments on commit 716822c

Please sign in to comment.