Skip to content

Commit 414d496

Browse files
committed
Add an EditorConfig and clean up readme
Note: introducing these changes raises a question in the coveralls example at the bottom: does `nyc` really need to be run again for the report to be available? and wouldn’t it be better just to have the lcov report generated alongside the regular text display, and have the `after_success` command just `cat` and pipe it to `coveralls`?
1 parent f417897 commit 414d496

File tree

2 files changed

+42
-20
lines changed

2 files changed

+42
-20
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
# Change these settings to your own preference
10+
indent_style = space
11+
indent_size = 2
12+
13+
# We recommend you to keep these unchanged
14+
end_of_line = lf
15+
charset = utf-8
16+
trim_trailing_whitespace = true
17+
insert_final_newline = true
18+
19+
[*.md]
20+
trim_trailing_whitespace = false

README.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ nyc --extension .jsx --extension .es6 npm test
6868
```
6969

7070
```json
71-
{"nyc": {
72-
"extensions": [
71+
{
72+
"nyc": {
73+
"extensions": [
7374
".jsx",
7475
".es6"
7576
]
@@ -121,7 +122,7 @@ You can tell nyc to exclude specific files and directories by adding
121122
an `nyc.exclude` array to your `package.json`. Each element of
122123
the array is a glob pattern indicating which paths should be omitted.
123124

124-
Globs are matched using [micromatch](https://www.npmjs.com/package/micromatch)
125+
Globs are matched using [micromatch](https://www.npmjs.com/package/micromatch).
125126

126127
In addition to patterns specified in the package, nyc will always exclude
127128
files in `node_modules`.
@@ -131,8 +132,9 @@ any files with the extension `.spec.js`, and anything in the `build`
131132
directory:
132133

133134
```json
134-
{"nyc": {
135-
"exclude": [
135+
{
136+
"nyc": {
137+
"exclude": [
136138
"**/*.spec.js",
137139
"build"
138140
]
@@ -176,7 +178,7 @@ You can run `nyc` with the optional `--cache` flag, to prevent it from
176178
instrumenting the same files multiple times. This can signficantly
177179
improve runtime performance.
178180

179-
## Configuring nyc
181+
## Configuring `nyc`
180182

181183
Any configuration options that can be set via the command line
182184
can also be specified in the `nyc` stanza of your package.json:
@@ -187,7 +189,7 @@ can also be specified in the `nyc` stanza of your package.json:
187189
"lines": 99,
188190
"check-coverage": false,
189191
"report-dir": "./alternative"
190-
},
192+
}
191193
}
192194
```
193195

@@ -210,28 +212,28 @@ integrated with coveralls and travis-ci.org:
210212
211213
1. add the coveralls and nyc dependencies to your module:
212214
213-
```shell
214-
npm install coveralls nyc --save
215-
```
215+
```shell
216+
npm install coveralls nyc --save
217+
```
216218

217219
2. update the scripts in your package.json to include these bins:
218220

219-
```bash
220-
{
221-
"script": {
222-
"test": "nyc tap ./test/*.js",
223-
"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
221+
```json
222+
{
223+
"script": {
224+
"test": "nyc tap ./test/*.js",
225+
"coverage": "nyc report --reporter=text-lcov | coveralls"
226+
}
224227
}
225-
}
226-
```
228+
```
227229

228230
3. For private repos, add the environment variable `COVERALLS_REPO_TOKEN` to travis.
229231

230232
4. add the following to your `.travis.yml`:
231233

232-
```yaml
233-
after_success: npm run coverage
234-
```
234+
```yaml
235+
after_success: npm run coverage
236+
```
235237
236238
That's all there is to it!
237239

0 commit comments

Comments
 (0)