2016-02-26 16:57:53 +00:00
|
|
|
/// <reference path="../ts/typings/main.d.ts" />
|
2016-04-01 13:56:35 +00:00
|
|
|
let plugins = {
|
2016-01-24 23:42:11 +00:00
|
|
|
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-01-24 23:42:11 +00:00
|
|
|
};
|
2016-04-01 13:56:35 +00:00
|
|
|
let should = require("should");
|
2016-01-24 23:42:11 +00:00
|
|
|
|
2016-04-01 13:56:35 +00:00
|
|
|
|
|
|
|
describe("gulpBrowser", function () {
|
|
|
|
describe(".browserify", function () {
|
|
|
|
it("should run through smoothly", function (done) {
|
2016-02-09 19:49:12 +00:00
|
|
|
this.timeout(30000);
|
2016-04-01 13:56:35 +00:00
|
|
|
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
|
|
|
});
|
2016-04-01 13:56:35 +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
|
|
|
});
|
|
|
|
});
|
2015-10-26 22:27:33 +00:00
|
|
|
});
|