Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
Tweak package scripts and travis config for code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism committed Mar 10, 2017
1 parent 707bf10 commit 1bc6235
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 16 deletions.
11 changes: 8 additions & 3 deletions .travis.yml
Expand Up @@ -13,8 +13,11 @@ node_js:
- '0.12'
- '0.10'
env:
- PKG_CMD="npm"
- PKG_CMD="yarn"
global:
- BABEL_ENV=test
matrix:
- PKG_CMD="npm"
- PKG_CMD="yarn"
before_install:
- nvm use $TRAVIS_NODE_VERSION
- npm set loglevel error
Expand All @@ -24,7 +27,7 @@ install:
- $PKG_CMD install
script:
- 'if [ -n "${LINT-}" ]; then $PKG_CMD run lint ; fi'
- 'if [ -z "${LINT-}" ]; then $PKG_CMD run ci ; fi'
- 'if [ -z "${LINT-}" ]; then $PKG_CMD run test-ci ; fi'
matrix:
fast_finish: true
exclude:
Expand All @@ -35,3 +38,5 @@ matrix:
include:
- node_js: "node"
env: LINT=true PKG_CMD="npm"

after_success: 'if [ -z "${LINT-}" ]; then npm run coverage-ci ; fi'
26 changes: 20 additions & 6 deletions CONTRIBUTING.md
@@ -1,8 +1,8 @@
## Contributing
# Contributing

### Adding a new plugin to support (when approved in the next ECMAScript version)
## Adding a new plugin to support (when approved in the next ECMAScript version)

#### Update [`plugin-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js)
### Update [`plugin-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js)

*Example:*

Expand All @@ -27,7 +27,7 @@ And add them in this structure:
},
```

#### Update [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js)
### Update [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js)

*Example:*

Expand All @@ -51,15 +51,29 @@ const es2017 = {
}
```

#### Update [`plugins.json`](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json)
### Update [`plugins.json`](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json)

Until `compat-table` is a standalone npm module for data we are using the git url

`"compat-table": "kangax/compat-table#[latest-commit-hash]"`,

So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.

### Writing Tests
## Tests

### Running tests locally

```bash
npm test
```

### Checking code coverage locally

```bash
npm run coverage
```

### Writing tests

#### General

Expand Down
18 changes: 11 additions & 7 deletions package.json
Expand Up @@ -10,13 +10,15 @@
"scripts": {
"build": "rimraf lib && babel src -d lib",
"build-data": "node ./scripts/build-data.js",
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'",
"coverage": "BABEL_ENV=test nyc npm run test",
"coverage-ci": "nyc report --reporter=json && codecov -f coverage/coverage-final.json",
"dev": "babel -w src -d lib",
"lint": "eslint .",
"fix": "eslint . --fix",
"cov": "BABEL_ENV=test nyc npm run test",
"ci": "npm run cov && nyc report --reporter=json && codecov -f coverage/coverage-final.json",
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'",
"test": "npm run build && mocha ./test --compilers js:babel-register -t 10000"
"lint": "eslint .",
"test": "npm run build && npm run test-only",
"test-ci": "nyc npm run test",
"test-only": "mocha ./test --compilers js:babel-register -t 10000"
},
"dependencies": {
"babel-plugin-check-es2015-constants": "^6.3.13",
Expand Down Expand Up @@ -55,7 +57,7 @@
"babel-eslint": "^7.1.1",
"babel-helper-fixtures": "^6.22.0",
"babel-helper-plugin-test-runner": "^6.18.0",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-istanbul": "^3.1.2",
"babel-plugin-transform-flow-strip-types": "^6.8.0",
"babel-preset-es2015": "^6.14.0",
"babel-register": "^6.14.0",
Expand Down Expand Up @@ -91,6 +93,8 @@
},
"nyc": {
"all": true,
"include": ["src/*.js"]
"include": ["src/*.js"],
"instrument": false,
"sourceMap": false
}
}

0 comments on commit 1bc6235

Please sign in to comment.