Skip to content

Commit 2856dff

Browse files
committed
Add more tests
1 parent 4ec92cd commit 2856dff

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/cases/parsing/issue-4940/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
define("local-module-object", function () {
2+
return {
3+
foo: "bar"
4+
};
5+
});
6+
7+
define("local-side-effect", function () {
8+
return {
9+
foo: null
10+
};
11+
});
12+
113
it("should create dependency when require is called with 'new' (object export)", function() {
214
const result = new require("./object-export");
315
result.foo.should.equal("bar");
@@ -9,3 +21,18 @@ it("should create dependency when require is called with 'new' (non-object expor
921
result.should.instanceof(__webpack_require__);
1022
sideEffect.foo.should.equal("bar");
1123
});
24+
25+
it("should create dependency when with a local dependency (object export)", function() {
26+
const result = new require("local-module-object");
27+
result.foo.should.equal("bar");
28+
});
29+
30+
it("should work within parentheses", function () {
31+
const result = new (require)("./object-export");
32+
result.foo.should.equal("bar");
33+
});
34+
35+
it("should work with local module in parentheses", function () {
36+
const result = new (require)("local-module-object");
37+
result.foo.should.equal("bar");
38+
});

0 commit comments

Comments
 (0)