Skip to content

Commit 72024d0

Browse files
author
David
committed
update testing
1 parent 9fd47a6 commit 72024d0

File tree

17 files changed

+646
-984
lines changed

17 files changed

+646
-984
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"targets": {
77
"node": [
8-
"4.0.0"
8+
"6.0.0"
99
]
1010
}
1111
}

.eslintrc.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
module.exports = {
22
root: true,
33
parser: "babel-eslint",
4-
plugins: [
5-
"import",
6-
"prettier"
7-
],
8-
"extends": [
4+
plugins: ["import", "prettier"],
5+
extends: [
96
"webpack",
107
"plugin:import/errors",
118
"plugin:import/warnings",
@@ -20,7 +17,7 @@ module.exports = {
2017
parserOptions: {
2118
ecmaVersion: 2017
2219
},
23-
rules:{
24-
'no-unused-vars': 'warn'
20+
rules: {
21+
"no-unused-vars": "warn"
2522
}
2623
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ typings/
6060
# my
6161
lib/
6262
.idea/
63+
cc-test-reporter

.lintstagedrc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
{
2-
"./**/*.js": [
3-
"prettier",
4-
"eslint --fix",
5-
"git add"
6-
],
7-
"./**/*.css": [
8-
"prettier",
9-
"git add"
10-
]
2+
"linters": {
3+
"./**/*.js": [
4+
"prettier",
5+
"eslint --fix",
6+
"git add"
7+
],
8+
"./**/*.css": [
9+
"prettier",
10+
"git add"
11+
]
12+
},
13+
"ignore": [
14+
"test/e2e/**/*.test.js"
15+
]
1116
}

.nycrc

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

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- "10"
5-
- "8"
4+
# - "10"
5+
# - "8"
66
- "6"
77
install:
88
- yarn
99
script:
10-
- yarn test
10+
- yarn coverage
1111

1212
env:
1313
global:
14-
- CC_TEST_REPORTER_ID=ABC123
14+
- CC_TEST_REPORTER_ID=8277f64d4123c1ec9bafeb8c2db8a72403277f27a1419f944d013951318db00e
1515

1616
before_install:
1717
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.6.0

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ A [clean-css](https://github.com/jakubpawlowicz/clean-css) loader for [webpack](
1414
[![npm](https://img.shields.io/npm/v/clean-css-loader.svg)](https://www.npmjs.com/package/clean-css-loader)
1515
[![npm clean-css-loader](https://img.shields.io/npm/dm/clean-css-loader.svg)](https://www.npmjs.com/package/clean-css-loader)
1616
[![Build Status](https://travis-ci.org/retyui/clean-css-loader.svg?branch=master)](https://travis-ci.org/retyui/clean-css-loader)
17+
[![Code Climate](https://codeclimate.com/github/retyui/clean-css-loader/badges/gpa.svg)](https://codeclimate.com/github/retyui/clean-css-loader)
18+
[![Test Coverage](https://codeclimate.com/github/retyui/clean-css-loader/badges/coverage.svg)](https://codeclimate.com/github/retyui/clean-css-loader/coverage)
1719
[![Greenkeeper badge](https://badges.greenkeeper.io/retyui/clean-css-loader.svg)](https://greenkeeper.io/)
1820

1921
## Install
2022

2123
```bash
22-
# for webpack@4 or 3 or 2
2324
yarn add -D clean-css-loader
24-
25-
# for webpack@1.x
26-
yarn add -D clean-css-loader@0.14.0
2725
```
2826

2927
## Usage

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
2-
coverageReporters: ["json"]
2+
collectCoverageFrom: ["test/unit/*.js", "src/*.js"],
3+
coverageReporters: ["lcov", "html"]
34
};

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clean-css-loader",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"main": "lib/index.js",
55
"dependencies": {
66
"clean-css": "^4.1.9",
@@ -16,9 +16,10 @@
1616
"e2e": "yarn force-clean ; yarn install-sub",
1717
"prebuild": "rimraf ./lib",
1818
"build": "babel src --out-dir lib",
19+
"format": "prettier \"test/unit/*.js\" \"src/*.js\" \"./*.js\" --write",
1920
"pretest": "yarn build",
2021
"test": "jest",
21-
"coverage": "nyc --clean jest --coverage",
22+
"coverage": "rimraf ./coverage; yarn test --coverage",
2223
"precommit": "lint-staged"
2324
},
2425
"description": "CleanCSS loader module for webpack",
@@ -34,7 +35,7 @@
3435
"lib"
3536
],
3637
"engines": {
37-
"node": ">=4.0.0"
38+
"node": ">=6.0.0"
3839
},
3940
"devDependencies": {
4041
"babel-cli": "^6.26.0",
@@ -51,7 +52,6 @@
5152
"jest": "^22.4.3",
5253
"lint-staged": "7.0.5",
5354
"npm-run-all": "^4.1.2",
54-
"nyc": "^11.7.1",
5555
"prettier": "1.12.1",
5656
"rimraf": "^2.6.1"
5757
}

src/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ export default function cleanCssLoader(css, map) {
1414

1515
return new CleanCSS(cleanCssOptions).minify(css, map, (err, minified) => {
1616
if (err) {
17-
if (Array.isArray(err) && err[0]) {
18-
return callback(err[0]);
19-
}
20-
return callback(err);
17+
return callback(err[0]);
2118
}
2219

2320
if (!cleanCssOptions.skipWarn && Array.isArray(minified.warnings)) {

0 commit comments

Comments
 (0)