2016-06-03 18:11:17 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
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-06-03 18:11:17 +00:00
|
|
|
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:58 +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gICAgfSk7XHJcbiAgICAgICAgXHJcbiAgICAgICAgaXQoXCJzaG91bGQgdGhyb3cgYW4gZXJyb3IsIHdoZW4gYSBtb2R1bGUgaXMgbm90IGZvdW5kXCIsIGZ1bmN0aW9uIChkb25lKSB7XHJcbiAgICAgICAgICAgIGxldCBkID0gcmVxdWlyZSgnZG9tYWluJykuY3JlYXRlKCk7XHJcbiAgICAgICAgICAgIGxldCBkb25lQ2FsbGVkID0gZmFsc2VcclxuICAgICAgICAgICAgZC5vbihcImVycm9yXCIsZnVuY3Rpb24oZXJyb3Ipe1xyXG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXJyb3IubWVzc2FnZSlcclxuICAgICAgICAgICAgICAgIGlmKCFkb25lQ2FsbGVkKXtcclxuICAgICAgICAgICAgICAgICAgICBkb25lKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZG9uZUNhbGxlZCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0pOyBcclxuICAgICAgICAgICAgZC5ydW4oZnVuY3Rpb24oKSB7IFxyXG4gICAgICAgICAgICAgICAgbGV0IHN0cmVhbSA9IHBsdWdpbnMuZ3VscC5zcmMoXCIuL3Rlc3QvdGVzdEJyb3dzZXJpZnlFcnJvci5qc1wiKVxyXG4gICAgICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEJyb3dzZXIuYnJvd3NlcmlmeSgpKTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgXHJcbiAgICAgICAgaXQoXCJzaG91bGQgcnVuIHRocm91Z2ggd2l0aCBhbiBlbXB0eSBmaWxlXCIsIGZ1bmN0aW9u
|