2016-02-26 16:57:53 +00:00
|
|
|
/// <reference path="../ts/typings/main.d.ts" />
|
2016-01-24 23:42:11 +00:00
|
|
|
var 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-01-24 23:42:11 +00:00
|
|
|
};
|
2016-04-01 13:56:35 +00:00
|
|
|
var should = require("should");
|
2016-02-01 02:10:58 +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
|
|
|
var 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) {
|
|
|
|
var d = require('domain').create();
|
|
|
|
var doneCalled = false;
|
|
|
|
d.on("error", function (error) {
|
|
|
|
console.log(error.message);
|
|
|
|
if (!doneCalled) {
|
|
|
|
done();
|
|
|
|
doneCalled = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
d.run(function () {
|
|
|
|
var 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) {
|
|
|
|
var 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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KSlcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEZ1bmN0aW9uKGRvbmUpKTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBcclxuICAgICAgICBpdChcInNob3VsZCB0aHJvdyBhbiBlcnJvciwgd2hlbiBhIG1vZHVsZSBpcyBub3QgZm91bmRcIiwgZnVuY3Rpb24gKGRvbmUpIHtcclxuICAgICAgICAgICAgbGV0IGQgPSByZXF1aXJlKCdkb21haW4nKS5jcmVhdGUoKTtcclxuICAgICAgICAgICAgbGV0IGRvbmVDYWxsZWQgPSBmYWxzZVxyXG4gICAgICAgICAgICBkLm9uKFwiZXJyb3JcIixmdW5jdGlvbihlcnJvcil7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvci5tZXNzYWdlKVxyXG4gICAgICAgICAgICAgICAgaWYoIWRvbmVDYWxsZWQpe1xyXG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICBkb25lQ2FsbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7IFxyXG4gICAgICAgICAgICBkLnJ1bihmdW5jdGlvbigpIHsgXHJcbiAgICAgICAgICAgICAgICBsZXQgc3RyZWFtID0gcGx1Z2lucy5ndWxwLnNyYyhcIi4vdGVzdC90ZXN0QnJvd3NlcmlmeUVycm9yLmpzXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnBpcGUocGx1Z2lucy5ndWxwQnJvd3Nlci5icm93c2VyaWZ5KCkpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBcclxuICAgICAgICBpdChcInNo
|