gulp-browser/test/test.ts

58 lines
2.1 KiB
TypeScript
Raw Normal View History

2016-06-03 18:11:17 +00:00
import "typings-test"
let plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
2016-02-26 16:57:53 +00:00
gulpBrowser: require("../dist/index.js"),
2016-02-01 02:38:58 +00:00
gulpFunction: require("gulp-function")
};
2016-06-03 18:11:17 +00:00
import "should";
describe("gulpBrowser", function () {
describe(".browserify", function () {
it("should run through smoothly", function (done) {
2016-02-09 19:49:12 +00:00
this.timeout(30000);
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
.pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpFunction(done));
});
it("should throw an error, when a module is not found", function (done) {
let d = require('domain').create();
let doneCalled = false
d.on("error",function(error){
console.log(error.message)
if(!doneCalled){
done();
doneCalled = true;
}
});
d.run(function() {
let stream = plugins.gulp.src("./test/testBrowserifyError.js")
.pipe(plugins.gulpBrowser.browserify());
2016-02-01 02:10:58 +00:00
});
});
it("should run through with an empty file", function (done) {
let stream = plugins.gulp.src('./test/testBrowserifyEmpty.js')
.pipe(plugins.gulpBrowser.browserify())
.pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpFunction(done));
2016-02-01 02:10:58 +00:00
});
2016-06-03 18:57:10 +00:00
it("should run through work with transforms", function (done) {
this.timeout(30000);
let transforms = [
{
transform: "babelify",
options: {presets: ["es2015", "react"]}
}
];
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
.pipe(plugins.gulpBrowser.browserify(transforms))
.pipe(plugins.gulp.dest("./test/result/"))
.pipe(plugins.gulpFunction(done));
});
2016-02-01 02:10:58 +00:00
});
2015-10-26 22:27:33 +00:00
});