Skip to content

Commit 89415f7

Browse files
committed
Make tests pass, fix require.ensure syntax
1 parent 6ed45d4 commit 89415f7

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎test/cases/parsing/issue-758/index.js‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
it("should require existing module with supplied error callback", function(done) {
22
require.ensure(['./file'], function(){
3-
var file = require('.file');
3+
var file = require('./file');
44
file.should.be.eql("file");
55
done();
66
}, function(error) {});
77
});
88

99
it("should call error callback on missing module", function(done) {
10-
require.ensure(['./missingModule'], function(){}, function(error) {
10+
require.ensure(['./missingModule'], function(){
11+
require('./missingModule');
12+
}, function(error) {
1113
error.should.be.instanceOf(Error);
1214
error.message.should.be.eql('Cannot find module "./missingModule"');
1315
done();
@@ -16,7 +18,9 @@ it("should call error callback on missing module", function(done) {
1618

1719
it("should call error callback on missing module in context", function(done) {
1820
(function(module) {
19-
require.ensure(['./' + module], function(){}, function(error) {
21+
require.ensure([], function(){
22+
require('./' + module);
23+
}, function(error) {
2024
error.should.be.instanceOf(Error);
2125
error.message.should.be.eql("Cannot find module './missingModule'.");
2226
done();
@@ -25,7 +29,9 @@ it("should call error callback on missing module in context", function(done) {
2529
});
2630

2731
it("should call error callback on exception thrown in loading module", function(done) {
28-
require.ensure(['./throwing'], function(){}, function(error) {
32+
require.ensure(['./throwing'], function(){
33+
require('./throwing');
34+
}, function(error) {
2935
error.should.be.instanceOf(Error);
3036
error.message.should.be.eql('message');
3137
done();
@@ -34,6 +40,7 @@ it("should call error callback on exception thrown in loading module", function(
3440

3541
it("should not call error callback on exception thrown in require callback", function(done) {
3642
require.ensure(['./throwing'], function() {
43+
require('./throwing');
3744
throw new Error('message');
3845
}, function(error) {
3946
error.should.be.instanceOf(Error);

0 commit comments

Comments
 (0)