diff --git a/experimental/babel-preset-env/.travis.yml b/experimental/babel-preset-env/.travis.yml index e29bd24054..3a9555b132 100644 --- a/experimental/babel-preset-env/.travis.yml +++ b/experimental/babel-preset-env/.travis.yml @@ -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 @@ -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: @@ -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' diff --git a/experimental/babel-preset-env/CONTRIBUTING.md b/experimental/babel-preset-env/CONTRIBUTING.md index 47de5fa6b3..275636d026 100644 --- a/experimental/babel-preset-env/CONTRIBUTING.md +++ b/experimental/babel-preset-env/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:* @@ -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:* @@ -51,7 +51,7 @@ 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 @@ -59,7 +59,21 @@ Until `compat-table` is a standalone npm module for data we are using the git ur 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 diff --git a/experimental/babel-preset-env/package.json b/experimental/babel-preset-env/package.json index f2d61daea7..2d2a50d296 100644 --- a/experimental/babel-preset-env/package.json +++ b/experimental/babel-preset-env/package.json @@ -10,13 +10,15 @@ "scripts": { "build": "rimraf lib && babel src -d lib", "build-data": "node ./scripts/build-data.js", - "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" + "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", + "fix": "eslint . --fix", + "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", @@ -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", @@ -91,6 +93,8 @@ }, "nyc": { "all": true, - "include": ["src/*.js"] + "include": ["src/*.js"], + "instrument": false, + "sourceMap": false } }