forked from FullHuman/purgecss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
27 lines (25 loc) · 827 Bytes
/
Copy pathindex.test.ts
File metadata and controls
27 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import fs from "fs";
import path from "path";
import { rollup } from "rollup";
import purgecss from "./../src/";
describe("rollup-plugin-purgecss", () => {
it("remove unused css", async () => {
const bundle = await rollup({
input: path.resolve(__dirname, "fixtures/basic/index.js"),
plugins: [
purgecss({
content: [path.resolve(__dirname, "assets/test_a.html")],
output: path.resolve(__dirname, "assets/actual_a.css"),
}),
],
});
await bundle.generate({ format: "cjs", exports: "auto" });
const actualA = fs
.readFileSync(path.resolve(__dirname, "assets/actual_a.css"))
.toString();
const expectA = fs
.readFileSync(path.resolve(__dirname, "assets/expect_a.css"))
.toString();
expect(actualA).toEqual(expectA);
});
});