webpack/test/configCases/externals/async-externals/index.js

22 lines
574 B
JavaScript
Raw Normal View History

import value from "promise-external";
import request from "import-external";
it("should allow async externals", () => {
expect(value).toBe(42);
expect(request).toBe("/hello/world.js");
});
it("should allow to catch errors of async externals", () => {
return expect(() => import("failing-promise-external")).rejects.toEqual(
expect.objectContaining({
message: "external reject"
})
);
});
2020-08-05 01:37:16 +08:00
it("should allow dynamic import promise externals", () => {
return import("promise-external").then(module => {
expect(module).toMatchObject({ default: value });
});
});