Skip to content

Commit 6cd6510

Browse files
test: Fix insert tests (faceyspacey#202)
* test: adding puppeteer tests * test: finalize e2e tests * linting improvements * test: improving tests * fix: pulling additional code from webpack upstream * docs: update README * refactor: remove husky
1 parent fcb8818 commit 6cd6510

35 files changed

+1807
-115
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/node_modules
1+
/coverage
22
/dist
3+
/node_modules
4+
/test/fixtures
35
/test/cases/*/expected
46
/test/js
5-
/test/manual

.eslintrc.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
module.exports = {
22
root: true,
33
parser: 'babel-eslint',
4-
plugins: ['prettier'],
5-
extends: ['@webpack-contrib/eslint-config-webpack'],
6-
rules: {
7-
'prettier/prettier': ['error'],
8-
},
4+
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier'],
95
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ package-lock.json -diff
22
* text=auto
33
test/cases/* eol=lf
44
bin/* eol=lf
5+
yarn.lock -diff

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Thumbs.db
1515
*.sublime-project
1616
*.sublime-workspace
1717
.idea
18+
*.iml

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
/test/cases/*/expected
66
/test/js
77
CHANGELOG.md
8-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If you like our work, check out our Redux-based router <a href="https://github.c
2929
> **HEADLINES (May 2018): Now Independently supports Webpack 4:**
3030
> Yep that's right. The universal family is now fully Webpack 4. Thank you to all our users for your loyalty and patience! If you love Universal, then you are gonna fall head over heels when we bring out the main course!
3131
32-
So... why did we rebuild `extract-css-chunks`? What does it offer?
32+
So... why did we rebuild `extract-css-chunks-webpack-plugin`? What does it offer?
3333

3434
It's got all the goodness of `mini-css-extract-plugin` but with 2 gleaming, sought after benefits.
3535

husky.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
testURL: 'http://localhost/',
3+
preset: 'jest-puppeteer',
34
transformIgnorePatterns: ['/node_modules/', '<rootDir>/dist/'],
45
watchPathIgnorePatterns: ['<rootDir>/test/js'],
56
};

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"node": ">= 6.9.0"
3636
},
3737
"scripts": {
38+
"commit": "git-cz",
3839
"start": "npm run build -- -w",
3940
"prebuild": "npm run clean",
4041
"build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files",
@@ -80,9 +81,11 @@
8081
"@webpack-contrib/eslint-config-webpack": "3.0.0",
8182
"babel-eslint": "10.0.3",
8283
"babel-jest": "24.9.0",
84+
"commitizen": "^4.0.3",
8385
"commitlint-azure-pipelines-cli": "1.0.3",
8486
"cross-env": "5.2.1",
8587
"css-loader": "3.4.2",
88+
"cz-conventional-changelog": "^3.0.2",
8689
"del": "4.1.1",
8790
"del-cli": "1.1.0",
8891
"es-check": "5.1.0",
@@ -93,12 +96,16 @@
9396
"file-loader": "4.3.0",
9497
"husky": "3.1.0",
9598
"jest": "24.9.0",
99+
"jest-dev-server": "^4.4.0",
96100
"jest-junit": "10.0.0",
101+
"jest-puppeteer": "^4.4.0",
97102
"lint-staged": "9.5.0",
98103
"memfs": "3.0.3",
99104
"npm-run-all": "4.1.5",
100105
"prerender-loader": "1.3.0",
101106
"prettier": "1.19.1",
107+
"puppeteer": "^2.0.0",
108+
"serve": "^11.3.0",
102109
"standard-version": "7.0.1",
103110
"webpack": "4.41.5",
104111
"webpack-cli": "3.3.10",

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable class-methods-use-this */
2+
13
import webpack from 'webpack';
24
import sources from 'webpack-sources';
35

@@ -23,7 +25,7 @@ const REGEXP_PLACEHOLDERS = /\[(name|id|chunkhash)\]/g;
2325
const DEFAULT_FILENAME = '[name].css';
2426

2527
class CssDependencyTemplate {
26-
apply() {} // eslint-disable-line class-methods-use-this
28+
apply() {}
2729
}
2830

2931
class CssModule extends webpack.Module {
@@ -71,7 +73,6 @@ class CssModule extends webpack.Module {
7173
this.sourceMap = module.sourceMap;
7274
}
7375

74-
// eslint-disable-next-line class-methods-use-this
7576
needRebuild() {
7677
return true;
7778
}
@@ -92,7 +93,6 @@ class CssModule extends webpack.Module {
9293
}
9394

9495
class CssModuleFactory {
95-
// eslint-disable-next-line class-methods-use-this
9696
create({ dependencies: [dependency] }, callback) {
9797
callback(null, new CssModule(dependency));
9898
}
@@ -399,7 +399,7 @@ class ExtractCssChunksPlugin {
399399
);
400400
});
401401
}
402-
// eslint-disable-next-line class-methods-use-this
402+
403403
getCssChunkObject(mainChunk) {
404404
const obj = {};
405405

test/HMR.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @jest-environment jsdom
3+
*/
14
/* eslint-env browser */
25
/* eslint-disable no-console */
36

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],[
2+
/* 0 */,
3+
/* 1 */
4+
/***/ (function(module, exports, __webpack_require__) {
5+
6+
// extracted by extract-css-chunks-webpack-plugin
7+
8+
/***/ })
9+
]]);

0 commit comments

Comments
 (0)