Skip to content

Commit 45e22e8

Browse files
committed
test(option): added testing of disableAsync option
1 parent e6358e1 commit 45e22e8

File tree

6 files changed

+89
-0
lines changed

6 files changed

+89
-0
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"test:watch": "cross-env NODE_ENV=test jest --watch",
2929
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
3030
"test:manual": "webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
31+
"test:manualDisableAsync": "webpack-dev-server test/manualDisableAsyncOption/src/index.js --open --config test/manualDisableAsyncOption/webpack.config.js",
3132
"pretest": "npm run lint",
3233
"test": "cross-env NODE_ENV=test npm run test:coverage",
3334
"defaults": "webpack-defaults"
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>mini-css-extract-plugin testcase</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="stylesheet" type="text/css" href="/dist/a.css" />
9+
</head>
10+
<body>
11+
<script type="text/javascript" src="/dist/a.js"></script>
12+
<script type="text/javascript" src="/dist/b.js"></script>
13+
<script type="text/javascript" src="/dist/main.js"></script>
14+
</body>
15+
</html>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.container {
2+
background: blue;
3+
color: red;
4+
width: 100%;
5+
height: 20px;
6+
text-align: center;
7+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.container {
2+
background: purple;
3+
color: green;
4+
width: 100%;
5+
height: 20px;
6+
text-align: center;
7+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-env browser */
2+
3+
import './a.css';
4+
import './b.css';
5+
6+
const render = () => {
7+
const div = document.createElement('div');
8+
div.setAttribute('class', 'container');
9+
const text = 'My background color should be blue, and my text should be red!';
10+
div.innerHTML = text;
11+
document.body.appendChild(div);
12+
};
13+
14+
render();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const Self = require('../../');
2+
3+
module.exports = {
4+
mode: 'development',
5+
output: {
6+
chunkFilename: '[name].js',
7+
publicPath: '/dist/',
8+
crossOriginLoading: 'anonymous',
9+
},
10+
optimization: {
11+
splitChunks: {
12+
cacheGroups: {
13+
default: false,
14+
a: {
15+
name: 'a',
16+
test: /a.css/,
17+
chunks: 'all',
18+
enforce: true,
19+
},
20+
b: {
21+
name: 'b',
22+
test: /b.css/,
23+
chunks: 'all',
24+
enforce: true,
25+
},
26+
},
27+
},
28+
},
29+
module: {
30+
rules: [
31+
{
32+
test: /\.css$/,
33+
use: [Self.loader, 'css-loader'],
34+
},
35+
],
36+
},
37+
plugins: [
38+
new Self({
39+
filename: '[name].css',
40+
}),
41+
],
42+
devServer: {
43+
contentBase: __dirname,
44+
},
45+
};

0 commit comments

Comments
 (0)