Skip to content

Commit e5cc07e

Browse files
committed
added webpack#387 test cases
1 parent 66b0955 commit e5cc07e

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 4321;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
it("should parse cujojs UMD modules", function() {
2+
(function (define) {
3+
4+
// using the define signature that triggers AMD-wrapped CommonJS
5+
define(function (require) {
6+
return 123;
7+
});
8+
}(
9+
typeof define == 'function' && define.amd
10+
? define
11+
: function (factory) { module.exports = factory(require); }
12+
));
13+
module.exports.should.be.eql(123);
14+
});
15+
16+
it("should parse cujojs UMD modules with deps", function() {
17+
(function (define) {
18+
19+
// dependencies are listed in the dependency array
20+
define(['./file'], function (file) {
21+
return 1234;
22+
});
23+
24+
}(
25+
typeof define == 'function' && define.amd
26+
? define
27+
: function (ids, factory) {
28+
// note: the lambda function cannot be removed in some CJS environments
29+
var deps = ids.map(function (id) { return require(id); });
30+
module.exports = factory.apply(null, deps);
31+
}
32+
));
33+
module.exports.should.be.eql(1234);
34+
});
35+
36+
it("should parse cujojs UMD modules with inlinded deps", function() {
37+
(function (define) {
38+
39+
// using the define signature that triggers AMD-wrapped CommonJS
40+
define(function (require) {
41+
return require("./file");
42+
});
43+
}(
44+
typeof define == 'function' && define.amd
45+
? define
46+
: function (factory) { module.exports = factory(require); }
47+
));
48+
module.exports.should.be.eql(4321);
49+
});

0 commit comments

Comments
 (0)