From 716822cdec4e2e4e85998cdb074fcebe75a8e01d Mon Sep 17 00:00:00 2001 From: Termina1 Date: Mon, 2 May 2016 00:57:09 +0300 Subject: [PATCH] add tests for passed options to gulp error --- test.js | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/test.js b/test.js index 5ad6558..9eb33b4 100644 --- a/test.js +++ b/test.js @@ -18,9 +18,9 @@ it('should pass file when it isNull()', function (cb) { assert.equal(data, emptyFile) cb() }) - + stream.write(emptyFile) - + stream.end() }) @@ -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 )