forked from systemjs/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anon-compile.js
43 lines (36 loc) · 1.16 KB
/
anon-compile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var Builder = require('../index');
var builder = new Builder();
builder.loadConfigSync('./test/fixtures/test-tree.config.js');
builder.config({ transpiler: 'babel' });
suite('Anonymous Compilation', function() {
test('AMD', function(done) {
builder.compile('amd.js').then(function(output) {
assert.match(output.source, /define\(\["\.\/global\.js"/);
})
.then(done, done);
});
test('CJS', function(done) {
builder.compile('cjs.js').then(function(output) {
assert.match(output.source, /System\.registerDynamic\(\[\]/);
})
.then(done, done);
});
test('Global', function(done) {
builder.compile('global.js').then(function(output) {
assert.match(output.source, /System\.registerDynamic\(\["\.\/jquery\.js"/);
})
.then(done, done);
});
test('Register', function(done) {
builder.compile('third.js').then(function(output) {
assert.match(output.source, /System\.register\(\['\.\/second.js'\]/);
})
.then(done, done);
});
test('ES', function(done) {
builder.compile('first.js').then(function(output) {
assert.match(output.source, /System\.register\(\[/);
})
.then(done, done);
});
});