@buxlabs/gulp-amd-to-before-all
v1.1.0
Published
gulp plugin that transpiles amd to jasmine's beforeAll
Downloads
5
Readme
gulp plugin that converts AMD syntax to beforeAll
Idea
Running thousands of unit tests might be time consuming. To speed up the start time slightly you might try to use the beforeAll syntax instead of AMD. This way the browser will load the dependencies before the given spec starts instead of loading all of them in the beginning.
Installation
npm install @buxlabs/gulp-amd-to-before-all
Usage
Convert files with:
const gulp = require('gulp');
const converter = require('@buxlabs/gulp-amd-to-before-all');
module.exports = function (options) {
return gulp.src(options.src)
.pipe(converter())
.pipe(gulp.dest(options.dest));
};
Example:
AMD
define(['backbone'], function (Backbone) {
'use strict';
describe('Backbone', function () {
it('is defined', function () {
expect(Backbone).toBeDefined();
});
});
});
beforeAll
describe('Backbone', function () {
var Backbone;
beforeAll(function (done) {
require(["backbone"], function () {
Backbone = arguments[0];
done();
});
});
it('is defined', function () {
expect(Backbone).toBeDefined();
});
});