Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Commit 7312f79

Browse files
committed
add test with only option
- add integration test with only option based on the example
1 parent e48dd76 commit 7312f79

File tree

12 files changed

+338
-0
lines changed

12 files changed

+338
-0
lines changed

__tests__/__snapshots__/webpack-integration.test.js.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,33 @@ md\\\\:w-2\\\\/3 {
1414
}
1515
"
1616
`;
17+
18+
exports[`Webpack Integration Tests simple-with-exclusion 1`] = `
19+
".hello {
20+
color: red;
21+
}
22+
23+
.whitelisted {
24+
color: green;
25+
}
26+
27+
md\\\\:w-2\\\\/3 {
28+
color: red;
29+
}
30+
"
31+
`;
32+
33+
exports[`Webpack Integration Tests simple-with-exclusion 2`] = `
34+
".legacy-unused-class {
35+
color: red;
36+
}
37+
38+
.unused-too {
39+
color: blue;
40+
}
41+
42+
.hello {
43+
color: red;
44+
}
45+
"
46+
`;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.hello {
2+
color: red;
3+
}
4+
5+
.whitelisted {
6+
color: green;
7+
}
8+
9+
md\:w-2\/3 {
10+
color: red;
11+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
/******/
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
/******/
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId]) {
10+
/******/ return installedModules[moduleId].exports;
11+
/******/ }
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ i: moduleId,
15+
/******/ l: false,
16+
/******/ exports: {}
17+
/******/ };
18+
/******/
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
/******/
22+
/******/ // Flag the module as loaded
23+
/******/ module.l = true;
24+
/******/
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
/******/
29+
/******/
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
/******/
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
/******/
36+
/******/ // define getter function for harmony exports
37+
/******/ __webpack_require__.d = function(exports, name, getter) {
38+
/******/ if(!__webpack_require__.o(exports, name)) {
39+
/******/ Object.defineProperty(exports, name, {
40+
/******/ configurable: false,
41+
/******/ enumerable: true,
42+
/******/ get: getter
43+
/******/ });
44+
/******/ }
45+
/******/ };
46+
/******/
47+
/******/ // getDefaultExport function for compatibility with non-harmony modules
48+
/******/ __webpack_require__.n = function(module) {
49+
/******/ var getter = module && module.__esModule ?
50+
/******/ function getDefault() { return module['default']; } :
51+
/******/ function getModuleExports() { return module; };
52+
/******/ __webpack_require__.d(getter, 'a', getter);
53+
/******/ return getter;
54+
/******/ };
55+
/******/
56+
/******/ // Object.prototype.hasOwnProperty.call
57+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58+
/******/
59+
/******/ // __webpack_public_path__
60+
/******/ __webpack_require__.p = "";
61+
/******/
62+
/******/ // Load entry module and return exports
63+
/******/ return __webpack_require__(__webpack_require__.s = 0);
64+
/******/ })
65+
/************************************************************************/
66+
/******/ ([
67+
/* 0 */
68+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
69+
70+
"use strict";
71+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
72+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__ = __webpack_require__(1);
73+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__);
74+
75+
76+
function component() {
77+
var element = document.createElement('div')
78+
79+
element.classList.add('hello')
80+
element.classList.add('md:w-2/3')
81+
return element
82+
}
83+
84+
document.body.appendChild(component())
85+
86+
87+
/***/ }),
88+
/* 1 */
89+
/***/ (function(module, exports) {
90+
91+
// removed by extract-text-webpack-plugin
92+
93+
/***/ })
94+
/******/ ]);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.legacy-unused-class {
2+
color: red;
3+
}
4+
5+
.unused-too {
6+
color: blue;
7+
}
8+
9+
.hello {
10+
color: red;
11+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
/******/
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
/******/
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId]) {
10+
/******/ return installedModules[moduleId].exports;
11+
/******/ }
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ i: moduleId,
15+
/******/ l: false,
16+
/******/ exports: {}
17+
/******/ };
18+
/******/
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
/******/
22+
/******/ // Flag the module as loaded
23+
/******/ module.l = true;
24+
/******/
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
/******/
29+
/******/
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
/******/
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
/******/
36+
/******/ // define getter function for harmony exports
37+
/******/ __webpack_require__.d = function(exports, name, getter) {
38+
/******/ if(!__webpack_require__.o(exports, name)) {
39+
/******/ Object.defineProperty(exports, name, {
40+
/******/ configurable: false,
41+
/******/ enumerable: true,
42+
/******/ get: getter
43+
/******/ });
44+
/******/ }
45+
/******/ };
46+
/******/
47+
/******/ // getDefaultExport function for compatibility with non-harmony modules
48+
/******/ __webpack_require__.n = function(module) {
49+
/******/ var getter = module && module.__esModule ?
50+
/******/ function getDefault() { return module['default']; } :
51+
/******/ function getModuleExports() { return module; };
52+
/******/ __webpack_require__.d(getter, 'a', getter);
53+
/******/ return getter;
54+
/******/ };
55+
/******/
56+
/******/ // Object.prototype.hasOwnProperty.call
57+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58+
/******/
59+
/******/ // __webpack_public_path__
60+
/******/ __webpack_require__.p = "";
61+
/******/
62+
/******/ // Load entry module and return exports
63+
/******/ return __webpack_require__(__webpack_require__.s = 2);
64+
/******/ })
65+
/************************************************************************/
66+
/******/ ([
67+
/* 0 */,
68+
/* 1 */,
69+
/* 2 */
70+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
71+
72+
"use strict";
73+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
74+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_css__ = __webpack_require__(3);
75+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_css__);
76+
77+
78+
79+
/***/ }),
80+
/* 3 */
81+
/***/ (function(module, exports) {
82+
83+
// removed by extract-text-webpack-plugin
84+
85+
/***/ })
86+
/******/ ]);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.hello {
2+
color: red;
3+
}
4+
5+
.whitelisted {
6+
color: green;
7+
}
8+
9+
md\:w-2\/3 {
10+
color: red;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.legacy-unused-class {
2+
color: red;
3+
}
4+
5+
.unused-too {
6+
color: blue;
7+
}
8+
9+
.hello {
10+
color: red;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import './style_that_we_want_to_purge.css'
2+
3+
function component() {
4+
var element = document.createElement('div')
5+
6+
element.classList.add('hello')
7+
element.classList.add('md:w-2/3')
8+
return element
9+
}
10+
11+
document.body.appendChild(component())
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './style.css'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.legacy-unused-class {
2+
color: red;
3+
}
4+
5+
.unused-too {
6+
color: blue;
7+
}
8+
9+
.hello {
10+
color: red;
11+
}

0 commit comments

Comments
 (0)