57 lines
7.9 KiB
JavaScript
57 lines
7.9 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
var plugins = {
|
|
beautylog: require("beautylog"),
|
|
gulp: require("gulp"),
|
|
gulpBrowser: require("../dist/index.js"),
|
|
gulpFunction: require("gulp-function")
|
|
};
|
|
require("should");
|
|
describe("gulpBrowser", function () {
|
|
describe(".browserify", function () {
|
|
it("should run through smoothly", function (done) {
|
|
this.timeout(30000);
|
|
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());
|
|
});
|
|
});
|
|
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));
|
|
});
|
|
it("should run through work with transforms", function (done) {
|
|
this.timeout(30000);
|
|
var transforms = [
|
|
{
|
|
transform: "babelify",
|
|
options: { presets: ["es2015"] }
|
|
}
|
|
];
|
|
var stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
|
.pipe(plugins.gulpBrowser.browserify(transforms))
|
|
.pipe(plugins.gulp.dest("./test/result/"))
|
|
.pipe(plugins.gulpFunction(done));
|
|
});
|
|
});
|
|
});
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLC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4gdGhyb3VnaCBzbW9vdGhseVwiLCBmdW5jdGlvbiAoZG9uZSkge1xyXG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMzAwMDApO1xyXG4gICAgICAgICAgICBsZXQgc3RyZWFtID0gcGx1Z2lucy5ndWxwLnNyYygnLi90ZXN0L3Rlc3RCcm93c2VyaWZ5Tm9ybWFsLmpzJylcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEJyb3dzZXIuYnJvd3NlcmlmeSgpKVxyXG4gICAgICAgICAgICAgICAgLnBpcGUocGx1Z2lucy5ndWxwLmRlc3QoXCIuL3Rlc3QvcmVzdWx0L1wiKSlcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEZ1bmN0aW9uKGRvbmUpKTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBcclxuICAgICAgICBpdChcInNob3VsZCB0aHJvdyBhbiBlcnJvciwgd2hlbiBhIG1vZHVsZSBpcyBub3QgZm91bmRcIiwgZnVuY3Rpb24gKGRvbmUpIHtcclxuICAgICAgICAgICAgbGV0IGQgPSByZXF1aXJlKCdkb21haW4nKS5jcmVhdGUoKTtcclxuICAgICAgICAgICAgbGV0IGRvbmVDYWxsZWQgPSBmYWxzZVxyXG4gICAgICAgICAgICBkLm9uKFwiZXJyb3JcIixmdW5jdGlvbihlcnJvcil7XHJcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnJvci5tZXNzYWdlKVxyXG4gICAgICAgICAgICAgICAgaWYoIWRvbmVDYWxsZWQpe1xyXG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcclxuICAgICAgICAgICAgICAgICAgICBkb25lQ2FsbGVkID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7IFxyXG4gICAgICAgICAgICBkLnJ1bihmdW5jdGlvbigpIHsgXHJcbiAgICAgICAgICAgICAgICBsZXQgc3RyZWFtID0gcGx1Z2lucy5ndWxwLnNyYyhcIi4vdGVzdC90ZXN0QnJvd3NlcmlmeUVycm9yLmpzXCIpXHJcbiAgICAgICAgICAgICAgICAgICAgLnBpcGUocGx1Z2lucy5ndWxwQnJvd3Nlci5icm93c2VyaWZ5KCkpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBcclxuICAgICAgICBpdChcInNob3VsZCBydW4gdGhyb3VnaCB3aXRoIGFuIGVtcHR5IGZpbGVcIiwgZnVuY3Rpb24gKGRvbmUpIHtcclxuICAgICAgICAgICAgbGV0IHN0cmVhbSA9IHBsdWdpbnMuZ3VscC5zcmMoJy4vdGVzdC90ZXN0QnJvd3NlcmlmeUVtcHR5LmpzJylcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEJyb3dzZXIuYnJvd3NlcmlmeSgpKVxyXG4gICAgICAgICAgICAgICAgLnBpcGUocGx1Z2lucy5ndWxwLmRlc3QoXCIuL3Rlc3QvcmVzdWx0L1wiKSlcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEZ1bmN0aW9uKGRvbmUpKTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBpdChcInNob3VsZCBydW4gdGhyb3VnaCB3b3JrIHdpdGggdHJhbnNmb3Jtc1wiLCBmdW5jdGlvbiAoZG9uZSkge1xyXG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMzAwMDApO1xyXG4gICAgICAgICAgICBsZXQgdHJhbnNmb3JtcyA9IFtcclxuICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm06IFwiYmFiZWxpZnlcIixcclxuICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7cHJlc2V0czogW1wiZXMyMDE1XCJdfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICBsZXQgc3RyZWFtID0gcGx1Z2lucy5ndWxwLnNyYygnLi90ZXN0L3Rlc3RCcm93c2VyaWZ5Tm9ybWFsLmpzJylcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscEJyb3dzZXIuYnJvd3NlcmlmeSh0cmFuc2Zvcm1zKSlcclxuICAgICAgICAgICAgICAgIC5waXBlKHBsdWdpbnMuZ3VscC5kZXN0KFwiLi90ZXN0L3Jlc3VsdC9cIikpXHJcbiAgICAgICAgICAgICAgICAucGlwZShwbHVnaW5zLmd1bHBGdW5jdGlvbihkb25lKSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICB9KTtcclxufSk7XHJcbiJdfQ==
|