chai-gulp-helpers
v0.0.3
Published
A simple test helper to verify that your stream returns the expected files.
Downloads
75
Maintainers
Readme
chai-gulp-helpers
This is a chai plugin for testing gulp plugins.
Installation
You can install chai-gulp-helpers via npm:
$ npm install --save-dev chai-gulp-helpers
Usage
Enable the plugin:
var chai = require("chai");
var chaiGulpHelpers = require("chai-gulp-helpers");
chai.use(chaiGulpHelpers);
This gives you two kinds of syntax:
// Verify that two arrays of Vinyl files are equal (have the same files with same content):
expect(fileList1).to.be.sameFilesAs(fileList2);
// Verify that two streams return the equal list of Vinyl files (returns a promise)
expect(stream1).to.produce.sameFilesAs(stream2);
Examples
describe("my gulp plugin", function () {
it("should do something", function () {
var expected = gulp.src("./expected/**/*", { base: "./expected/" });
var actual = gulp.src("./fixtures/**/*", { base: "./fixtures/" })
.pipe(myGulpPlugin());
return expect(actual).to.produce.sameFilesAs(expected);
});
});
This test will pass if the files in fixtures
folder processed by your plugin match those in the expected
folder.