2016-06-03 18:11:17 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
2016-07-26 16:15:03 +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-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-07-26 16:15:03 +00:00
|
|
|
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
2016-04-01 13:56:35 +00:00
|
|
|
.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) {
|
2016-07-26 16:15:03 +00:00
|
|
|
let d = require('domain').create();
|
|
|
|
let doneCalled = false;
|
2016-04-01 13:56:35 +00:00
|
|
|
d.on("error", function (error) {
|
|
|
|
console.log(error.message);
|
|
|
|
if (!doneCalled) {
|
|
|
|
done();
|
|
|
|
doneCalled = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
d.run(function () {
|
2016-07-26 16:15:03 +00:00
|
|
|
let stream = plugins.gulp.src("./test/testBrowserifyError.js")
|
2016-04-01 13:56:35 +00:00
|
|
|
.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) {
|
2016-07-26 16:15:03 +00:00
|
|
|
let stream = plugins.gulp.src('./test/testBrowserifyEmpty.js')
|
2016-04-01 13:56:35 +00:00
|
|
|
.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:34 +00:00
|
|
|
it("should run through work with transforms", function (done) {
|
2016-06-03 18:57:10 +00:00
|
|
|
this.timeout(30000);
|
2016-07-26 16:15:03 +00:00
|
|
|
let transforms = [
|
2016-06-03 18:57:10 +00:00
|
|
|
{
|
|
|
|
transform: "babelify",
|
2016-06-03 19:05:04 +00:00
|
|
|
options: { presets: ["es2015"] }
|
2016-06-03 18:57:10 +00:00
|
|
|
}
|
|
|
|
];
|
2016-07-26 16:15:03 +00:00
|
|
|
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
2016-06-03 18:57:10 +00:00
|
|
|
.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
|
|
|
});
|
2016-07-26 16:15:03 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7SUFDL0IsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFDckIsV0FBVyxFQUFFLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQztJQUN4QyxZQUFZLEVBQUUsT0FBTy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