Skip to content

Commit 716822c

Browse files
committed
add tests for passed options to gulp error
1 parent b69b793 commit 716822c

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

test.js

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ it('should pass file when it isNull()', function (cb) {
1818
assert.equal(data, emptyFile)
1919
cb()
2020
})
21-
21+
2222
stream.write(emptyFile)
23-
23+
2424
stream.end()
2525
})
2626

@@ -53,17 +53,45 @@ it('should correctly wrap postcss errors', function (cb) {
5353
stream.on('error', function (err) {
5454
assert.ok(err instanceof gutil.PluginError)
5555
assert.equal(err.plugin, 'gulp-postcss')
56+
assert.equal(err.showStack, false)
57+
assert.equal(err.fileName, "testpath")
5658
cb()
5759
})
5860

5961
stream.write(new gutil.File({
60-
contents: new Buffer('a {')
62+
contents: new Buffer('a {'),
63+
path: "testpath"
6164
}))
6265

6366
stream.end()
6467

6568
})
6669

70+
it('should respond with error on stream files', function (cb) {
71+
72+
var stream = postcss([ doubler ])
73+
74+
stream.on('error', function (err) {
75+
assert.ok(err instanceof gutil.PluginError)
76+
assert.equal(err.plugin, 'gulp-postcss')
77+
console.log(err)
78+
assert.equal(err.showStack, true)
79+
assert.equal(err.fileName, "testpath")
80+
cb()
81+
})
82+
83+
var streamFile = {
84+
isStream: function () { return true },
85+
isNull: function() { return false },
86+
path: "testpath"
87+
};
88+
89+
stream.write(streamFile)
90+
91+
stream.end()
92+
93+
})
94+
6795

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

0 commit comments

Comments
 (0)