Skip to content

Commit

Permalink
no-issue - generates lcov report
Browse files Browse the repository at this point in the history
  • Loading branch information
teles committed Sep 18, 2017
1 parent 0b3c5de commit 4028fb1
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env"]
}
21 changes: 21 additions & 0 deletions .generate-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

# Shell script to compute code coverage even after the Babel transforms have
# been applied.

# Clear previous coverage.
rm -rf coverage

# Generate test coverage based on however `npm test` performs the tests.
nyc --reporter=json npm test

# Move generated JSON file so it can be remapped and won't confuse Istanbul
# later.
mv coverage/coverage-final.json coverage/coverage.json

# Rewrite the coverage file taking the Babel source maps into account.
remap-istanbul -i coverage/coverage.json -o coverage/coverage.json

# Generate an lcov.info file and an HTML report, and output a text report.
istanbul report lcov text
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/node_modules/
/release/
/.idea/
/CLONED/
/coverage/
/.nyc_output/
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/src/
/src/
/coverage/
/.nyc_output/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js

node_js:
- 5.7

cache:
directories:
- node_modules

before_script:
- git config --global user.name 'Travis-ci'
- git config --global user.email 'josetelesmaciel@gmail.com'

script: npm run coverage & npm run coverage-to-codacy
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ let mixed = ArrayMixer({puppies, kittens, penguins}, ["puppies", "kittens", "pen
|-----------------------|-----------------------|-----------------------------------|------------------------------------------------------------------------------|
| [:dog:, :dog:, :dog:] | [:cat:, :cat:, :cat:] | [:penguin:, :penguin:, :penguin:] | [:dog:, :cat:, :penguin:, :dog:, :cat:, :penguin:, :dog:, :cat:, :penguin:] |

> All arrays mentioned in this section must exist for the examples to work.
 

### Example 7) Include 1 large photo for every 2 medium size photos followed by 3 small photos:

**Tip:** `ArrayMixer` lets you mix three or more arrays at once.
Expand Down Expand Up @@ -201,6 +198,8 @@ ArrayMixer({L:large, M:medium, S:small}, ["2M", "3S", "L"]);
<img src="https://placeholdit.imgix.net/~text?txtsize=26&txtclr=fff&bg=27ae60&txt=L[2]&w=78&h=78" align="left" vspace="10">
</table>

> **Disclaimer*: All arrays mentioned in this section must exist for the examples to work.
## Contributing

[Coming soon](CONTRIBUTING.md)
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"test": "ava src/spec.js",
"release": "babel src --presets babel-preset-env --out-dir release --source-maps --ignore ./src/spec.js --minified",
"prepublish": "npm run release"
"prepublish": "npm run release",
"coverage": "source .generate-coverage.sh",
"coverage-to-codacy": "cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage"
},
"ava": {
"files": [
Expand Down Expand Up @@ -42,6 +44,10 @@
"babel-cli": "6.26.0",
"babel-minify": "0.2.0",
"babel-preset-env": "1.6.0",
"eslint": "4.6.1"
"eslint": "4.6.1",
"istanbul": "0.4.5",
"nyc": "11.2.1",
"codacy-coverage": "2.0.2",
"remap-istanbul": "0.9.5"
}
}

0 comments on commit 4028fb1

Please sign in to comment.