add providedInfo test case

This commit is contained in:
Ivan Kopeykin 2022-04-12 16:01:27 +03:00
parent d3a0f8de03
commit 6eff5de1df
4 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1 @@
module.exports = require("./cjs3");

View File

@ -0,0 +1,3 @@
exports.a = 1;
exports.b = 2;
exports.cjs3DefaultProvidedInfo = __webpack_exports_info__.default.provideInfo;

View File

@ -0,0 +1,2 @@
export default 2;
export const esmDefaultProvidedInfo = __webpack_exports_info__.default.provideInfo;

View File

@ -1,6 +1,19 @@
import * as C from "./reexport-namespace";
import { counter } from "./reexport-namespace";
import * as C2 from "./reexport-namespace-again";
import cj2, { cjs3DefaultProvidedInfo } from "./cjs2";
import esm1, { esmDefaultProvidedInfo } from "./esm1";
it("default providedInfo should be correct for cjs", () => {
expect(cj2.a).toBe(1);
expect(cjs3DefaultProvidedInfo).toBe(false);
expect(__webpack_exports_info__.cj2.default.provideInfo).toBe(false);
});
it("default providedInfo and usedInfo should be correct for esm", () => {
expect(esm1).toBe(2);
expect(esmDefaultProvidedInfo).toBe(true);
});
it("should allow to reexport namespaces 1", () => {
(0, counter.reset)();