gulp-browser/test/test.ts

58 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-03-14 23:33:43 +00:00
import * as gulp from 'gulp';
2019-02-12 23:22:18 +00:00
import * as gulpFunction from '@pushrocks/gulp-function';
import * as smartpromise from '@pushrocks/smartpromise';
2019-02-12 23:22:18 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2017-07-07 16:32:37 +00:00
2018-03-14 23:33:43 +00:00
import * as gulpBrowser from '../ts/index';
2016-12-13 22:01:25 +00:00
2017-07-07 16:32:37 +00:00
tap.test('should run through smoothly', async () => {
2019-02-12 23:22:18 +00:00
let done = smartpromise.defer();
2018-03-14 23:33:43 +00:00
let stream = gulp
.src('./test/testBrowserifyNormal.js')
2017-07-07 16:32:37 +00:00
.pipe(gulpBrowser.browserify())
.pipe(gulp.dest('./test/result/'))
2018-03-14 23:33:43 +00:00
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
});
2016-12-13 22:01:25 +00:00
2017-07-07 16:32:37 +00:00
tap.test('should run through with an empty file', async () => {
2019-02-12 23:22:18 +00:00
let done = smartpromise.defer();
2018-03-14 23:33:43 +00:00
let stream = gulp
.src('./test/testBrowserifyEmpty.js')
2017-07-07 16:32:37 +00:00
.pipe(gulpBrowser.browserify())
.pipe(gulp.dest('./test/result/'))
2018-03-14 23:33:43 +00:00
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
});
2016-12-13 22:01:25 +00:00
2017-07-07 16:32:37 +00:00
tap.test('should run through work with transforms', async () => {
2019-02-12 23:22:18 +00:00
let done = smartpromise.defer();
2017-07-07 16:32:37 +00:00
let transforms = [
{
transform: 'babelify',
2018-03-14 23:33:43 +00:00
options: { presets: ['es2015'] }
2017-07-07 16:32:37 +00:00
}
2018-03-14 23:33:43 +00:00
];
let stream = gulp
.src('./test/testBrowserifyNormal.js')
2017-07-07 16:32:37 +00:00
.pipe(gulpBrowser.browserify(transforms))
.pipe(gulp.dest('./test/result/'))
2018-03-14 23:33:43 +00:00
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
});
2017-07-07 16:32:37 +00:00
2018-03-14 23:33:43 +00:00
tap.start();