2017-07-26 01:21:02 +08:00
|
|
|
it("should not bundle context requires with asyncMode === 'weak'", function() {
|
|
|
|
var contextRequire = require.context(".", false, /two/, "weak");
|
2018-01-27 06:59:38 +08:00
|
|
|
expect(function() {
|
2017-07-26 01:21:02 +08:00
|
|
|
contextRequire("./two")
|
2018-01-27 06:59:38 +08:00
|
|
|
}).toThrowError(/not available/);
|
2017-07-26 01:21:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should find module with asyncMode === 'weak' when required elsewhere", function() {
|
|
|
|
var contextRequire = require.context(".", false, /.+/, "weak");
|
2018-01-27 05:51:03 +08:00
|
|
|
expect(contextRequire("./three")).toBe(3);
|
2017-07-26 01:21:02 +08:00
|
|
|
require("./three"); // in a real app would be served as a separate chunk
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should find module with asyncMode === 'weak' when required elsewhere (recursive)", function() {
|
|
|
|
var contextRequire = require.context(".", true, /.+/, "weak");
|
2018-01-27 05:51:03 +08:00
|
|
|
expect(contextRequire("./dir/four")).toBe(4);
|
2017-07-26 01:21:02 +08:00
|
|
|
require("./dir/four"); // in a real app would be served as a separate chunk
|
|
|
|
});
|