Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 673d160

Browse files
committed
fix up tests
1 parent b97c6be commit 673d160

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

test/custom-loader.spec.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ describe('Custom Loader', function () {
66

77
describe('scripts', function () {
88
if (typeof __karma__ == 'undefined' || __karma__.config.system.ie8)
9-
it('should support ES6 scripts', function (done) {
10-
customLoader['import']('test/loader/test.js')
11-
.then(function (m) {
12-
expect(m.loader).to.be.equal('custom');
13-
})
14-
.then(done, done)
9+
it('should support ES6 scripts', function(done) {
10+
customLoader['import']('test/loader/test.js')
11+
.then(function (m) {
12+
expect(m.loader).to.be.equal('custom');
13+
})
14+
.then(done, done)
1515
});
1616

17-
it('should support AMD scripts', function (done) {
17+
it('should support AMD scripts', function(done) {
1818
customLoader['import']('test/loader/amd.js')
19-
.then(function (m) {
20-
expect(m.format).to.be.equal('amd');
21-
})
22-
.then(done, done);
19+
.then(function (m) {
20+
expect(m.format).to.be.equal('amd');
21+
})
22+
.then(done, done);
2323
});
2424
});
2525

2626
describe('special #locate path rule', function a() {
2727

2828
if (typeof __karma__ == 'undefined' || !__karma__.config.system.ie8)
29-
it('should support special loading rules', function (done) {
29+
it('should support special loading rules', function(done) {
3030
customLoader['import']('path/custom.js')
31-
.then(function (m) {
32-
expect(m.path).to.be.ok();
33-
})
34-
.then(done, done);
31+
.then(function (m) {
32+
expect(m.path).to.be.ok();
33+
})
34+
.then(done, done);
3535
});
3636

3737
});
@@ -43,60 +43,60 @@ describe('Custom Loader', function () {
4343
}
4444
var base = baseURL + 'test/loader/';
4545

46-
it('should make the normalize throw', function (done) {
46+
it('should make the normalize throw', function(done) {
4747
customLoader['import']('test/loader/error1-parent.js')
48-
.then(supposeToFail, function (e) {
49-
expect(e.toString()).to.contain('Error loading ' + base + 'error1-parent.js');
50-
})
51-
.then(done, done);
48+
.then(supposeToFail, function(e) {
49+
expect(e.toString()).to.contain('Error loading ' + base + 'error1-parent.js');
50+
})
51+
.then(done, done);
5252
});
5353

54-
it('should make the locate throw', function (done) {
54+
it('should make the locate throw', function(done) {
5555
customLoader['import']('test/loader/error2')
56-
.then(supposeToFail, function (e) {
57-
expect(e.toString()).to.be.contain('Error loading ' + base + 'error2');
58-
})
59-
.then(done, done);
56+
.then(supposeToFail, function(e) {
57+
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error2');
58+
})
59+
.then(done, done);
6060
});
6161

62-
it('should make the fetch throw', function (done) {
62+
it('should make the fetch throw', function(done) {
6363
customLoader['import']('test/loader/error3')
64-
.then(supposeToFail, function (e) {
65-
expect(e.toString()).to.be.contain('Error loading ' + base + 'error3');
66-
})
67-
.then(done, done);
64+
.then(supposeToFail, function(e) {
65+
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error3');
66+
})
67+
.then(done, done);
6868
});
6969

70-
it('should make the translate throw', function (done) {
70+
it('should make the translate throw', function(done) {
7171
customLoader['import']('test/loader/error4')
72-
.then(supposeToFail, function (e) {
73-
expect(e.toString()).to.be.contain('Error loading ' + base + 'error4');
74-
})
75-
.then(done, done);
72+
.then(supposeToFail, function(e) {
73+
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error4');
74+
})
75+
.then(done, done);
7676
});
7777

78-
it('should make the instantiate throw', function (done) {
78+
it('should make the instantiate throw', function(done) {
7979
customLoader['import']('test/loader/error5')
80-
.then(supposeToFail, function (e) {
81-
expect(e.toString()).to.be.contain('Error loading ' + base + 'error5');
82-
})
83-
.then(done, done);
80+
.then(supposeToFail, function(e) {
81+
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.contain('Error loading ' + base + 'error5');
82+
})
83+
.then(done, done);
8484
});
8585

8686
});
8787

8888
});
8989

9090
describe('#normalize', function () {
91-
it('should support async normalization', function (done) {
91+
it('should support async normalization', function(done) {
9292
customLoader.normalize('asdfasdf')
93-
.then(function (normalized) {
94-
return customLoader['import'](normalized);
95-
})
96-
.then(function (m) {
97-
expect(m.n).to.be.equal('n');
98-
})
99-
.then(done, done);
93+
.then(function (normalized) {
94+
return customLoader['import'](normalized);
95+
})
96+
.then(function (m) {
97+
expect(m.n).to.be.equal('n');
98+
})
99+
.then(done, done);
100100
});
101101
});
102102
});

test/system.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ describe('System', function () {
227227
System.import('test/loads/load-non-existent.js')
228228
.then(supposedToFail)
229229
.catch(function (e) {
230-
expect(e).to.be.match(/Error loading \S+/);
230+
expect(typeof window != 'undefined' ? e.toString() : e.stack).to.be.match(/Error loading \S+/);
231231
})
232232
.then(done, done);
233233
});

0 commit comments

Comments
 (0)