forked from webpack-contrib/mini-css-extract-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpathinfo.test.js
57 lines (52 loc) · 1.42 KB
/
pathinfo.test.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import path from "path";
import MiniCssExtractPlugin from "../src/cjs";
import { compile, getCompiler } from "./helpers/index";
describe("pathinfo option", () => {
it(`should insert pathinfo`, async () => {
const compiler = getCompiler(
"esm.js",
{},
{
mode: "none",
output: {
pathinfo: true,
path: path.resolve(__dirname, "../outputs"),
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
],
}
);
const stats = await compile(compiler);
const fs = stats.compilation.compiler.outputFileSystem;
const extractedCss = fs
.readFileSync(path.resolve(__dirname, "../outputs/main.css"))
.toString();
expect(extractedCss).toMatch("./simple.css");
});
it(`should not insert pathinfo`, async () => {
const compiler = getCompiler(
"esm.js",
{},
{
mode: "none",
output: {
path: path.resolve(__dirname, "../outputs"),
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
],
}
);
const stats = await compile(compiler);
const fs = stats.compilation.compiler.outputFileSystem;
const extractedCss = fs
.readFileSync(path.resolve(__dirname, "../outputs/main.css"))
.toString();
expect(extractedCss).not.toMatch("./simple.css");
});
});