Skip to content

Commit

Permalink
Add support for coverage metrics with nyc and coveralls. Coveralls in…
Browse files Browse the repository at this point in the history
…tegration will need to be turned on.
  • Loading branch information
hildjj committed May 8, 2018
1 parent df6608d commit 3f2b104
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,5 @@ node_modules/*
build/
package-lock.json
bench/*.svg
.nyc_output/
coverage/
10 changes: 10 additions & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,16 @@ node_js:
- "8"
- "9"

install:
- npm install
- npm install coveralls

script:
- npm run coverage

after_success:
- nyc report --reporter=text-lcov | coveralls

cache:
directories:
- node_modules
Expand Down
21 changes: 21 additions & 0 deletions .waiting.html
@@ -0,0 +1,21 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<style>
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 20px;
color:#333;
margin: 50px;
}
code {
color: green;
}
</style>
</head>
<body>
<div>This page will refresh with a coverage report, as long as you have
executed <code>npm run dev</code>. Please be patient.</div>
</body>
</html>
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -2,6 +2,8 @@

[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map)

[![Coverage Status](https://coveralls.io/repos/github/mozilla/source-map/badge.svg)](https://coveralls.io/github/mozilla/source-map)

[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map)

This is a library to generate and consume the source map format
Expand Down
25 changes: 21 additions & 4 deletions package.json
Expand Up @@ -59,15 +59,32 @@
},
"license": "BSD-3-Clause",
"scripts": {
"test": "npm run lint && npm run build && node test/run-tests.js",
"build": "webpack --color",
"lint": "eslint *.js lib/ test/",
"prebuild": "npm run lint",
"build": "webpack --color",
"pretest": "npm run build",
"test": "node test/run-tests.js",
"precoverage": "npm run build",
"coverage": "nyc node test/run-tests.js",
"setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true",
"dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage",
"dev:watch": "watch 'npm run coverage' lib/ test/",
"predev": "npm run setup",
"dev": "npm-run-all -p --silent dev:*",
"clean": "rm -rf coverage .nyc_output",
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
},
"devDependencies": {
"doctoc": "^0.15.0",
"webpack": "^3.10",
"eslint": "^4.19.1"
"eslint": "^4.19.1",
"live-server": "^1.2.0",
"npm-run-all": "^4.1.2",
"nyc": "^11.7.1",
"watch": "^1.0.2",
"webpack": "^3.10"
},
"nyc": {
"reporter": "html"
},
"typings": "source-map"
}

0 comments on commit 3f2b104

Please sign in to comment.