Skip to content

Commit bb9d307

Browse files
committed
fixed dll test cases
1 parent d3eaed9 commit bb9d307

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

test/ConfigTestCases.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ describe("ConfigTestCases", function() {
6262
console: console
6363
};
6464

65-
function _require(module) {
65+
function _require(currentDirectory, module) {
6666
if(Array.isArray(module) || /^\.\.?\//.test(module)) {
6767
var fn;
6868
var content;
6969
if(Array.isArray(module)) {
70-
var p = path.join(outputDirectory, module[0]);
70+
var p = path.join(currentDirectory, module[0]);
7171
content = module.map(function(p) {
72-
var p = path.join(outputDirectory, p);
72+
var p = path.join(currentDirectory, p);
7373
return fs.readFileSync(p, "utf-8");
7474
}).join("\n");
7575
} else {
76-
var p = path.join(outputDirectory, module);
76+
var p = path.join(currentDirectory, module);
7777
content = fs.readFileSync(p, "utf-8");
7878
}
7979
if(options.target === "web") {
@@ -84,7 +84,7 @@ describe("ConfigTestCases", function() {
8484
var module = {
8585
exports: {}
8686
};
87-
fn.call(module.exports, _require, module, module.exports, outputDirectory, p, _it, globalContext);
87+
fn.call(module.exports, _require.bind(null, path.dirname(p)), module, module.exports, path.dirname(p), p, _it, globalContext);
8888
return module.exports;
8989
} else if(testConfig.modules && module in testConfig.modules) {
9090
return testConfig.modules[module];
@@ -108,7 +108,7 @@ describe("ConfigTestCases", function() {
108108
var bundlePath = testConfig.findBundle(i, optionsArr[i]);
109109
if(bundlePath) {
110110
filesCount++;
111-
_require(bundlePath);
111+
_require(outputDirectory, bundlePath);
112112
}
113113
}
114114
// give a free pass to compilation that generated an error
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = function() {
22
return System.import("./c");
3-
}
3+
}

test/configCases/dll-plugin/1-use-dll/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ it("should load a module of non-default type without extension from dll", functi
1111
require("dll/f").should.be.eql("f");
1212
});
1313

14-
it("should load an async module from dll", function() {
14+
it("should load an async module from dll", function(done) {
1515
require("dll/b")().then(function(c) {
1616
c.should.be.eql({ default: "c" });
17-
});
17+
done();
18+
}).catch(done);
1819
});
1920

2021
it("should load an harmony module from dll (default export)", function() {

test/configCases/dll-plugin/2-use-dll-without-scope/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ it("should load a module from dll", function() {
77
require("../0-create-dll/a").should.be.eql("a");
88
});
99

10-
it("should load an async module from dll", function() {
10+
it("should load an async module from dll", function(done) {
1111
require("../0-create-dll/b")().then(function(c) {
1212
c.should.be.eql({ default: "c" });
13-
});
13+
done();
14+
}).catch(done);
1415
});
1516

1617
it("should load an harmony module from dll (default export)", function() {

0 commit comments

Comments
 (0)