2020-04-09 00:22:40 +08:00
|
|
|
import {
|
|
|
|
exportsInfoForA,
|
|
|
|
exportsInfoForB,
|
2020-04-09 06:18:39 +08:00
|
|
|
exportsInfoForC,
|
2020-04-09 00:22:40 +08:00
|
|
|
exportsInfoForY,
|
2020-04-09 15:33:25 +08:00
|
|
|
exportsInfoForZ,
|
2020-04-09 00:22:40 +08:00
|
|
|
exportsInfoForMixin1,
|
2020-04-09 06:18:39 +08:00
|
|
|
exportsInfoForMixin2,
|
|
|
|
exportsInfoForMixin3
|
2020-04-09 00:22:40 +08:00
|
|
|
} from "./dep2";
|
2020-04-06 03:56:53 +08:00
|
|
|
|
2020-04-09 00:22:40 +08:00
|
|
|
it("should load modules correctly", () => {
|
|
|
|
require("./module1");
|
|
|
|
require("./module2");
|
2020-04-06 03:56:53 +08:00
|
|
|
});
|
|
|
|
|
2020-07-08 18:22:55 +08:00
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
|
|
it("B should not be used", () => {
|
|
|
|
expect(exportsInfoForB).toBe(false);
|
|
|
|
});
|
|
|
|
}
|
2020-04-06 03:56:53 +08:00
|
|
|
|
|
|
|
it("A should be used", () => {
|
|
|
|
expect(exportsInfoForA).toBe(true);
|
|
|
|
});
|
2020-04-09 00:22:40 +08:00
|
|
|
|
2020-04-09 15:33:25 +08:00
|
|
|
it("Z used, inner graph can not determine const usage", () => {
|
|
|
|
expect(exportsInfoForZ).toBe(true);
|
|
|
|
});
|
|
|
|
|
2020-04-09 06:18:39 +08:00
|
|
|
it("Pure super expression should be unused, another used", () => {
|
2020-07-08 18:22:55 +08:00
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
|
|
expect(exportsInfoForMixin1).toBe(false);
|
|
|
|
}
|
2020-04-09 06:18:39 +08:00
|
|
|
|
2020-04-09 00:22:40 +08:00
|
|
|
expect(exportsInfoForMixin2).toBe(true);
|
2020-04-09 06:18:39 +08:00
|
|
|
expect(exportsInfoForMixin3).toBe(true);
|
|
|
|
expect(exportsInfoForC).toBe(true);
|
2020-04-09 00:22:40 +08:00
|
|
|
expect(exportsInfoForY).toBe(true);
|
|
|
|
});
|