Skip to content

Commit 3f2b104

Browse files
committed
Add support for coverage metrics with nyc and coveralls. Coveralls integration will need to be turned on.
1 parent df6608d commit 3f2b104

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ node_modules/*
55
build/
66
package-lock.json
77
bench/*.svg
8+
.nyc_output/
9+
coverage/

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ node_js:
66
- "8"
77
- "9"
88

9+
install:
10+
- npm install
11+
- npm install coveralls
12+
13+
script:
14+
- npm run coverage
15+
16+
after_success:
17+
- nyc report --reporter=text-lcov | coveralls
18+
919
cache:
1020
directories:
1121
- node_modules

.waiting.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Code coverage report for All files</title>
5+
<style>
6+
body {
7+
font-family: Helvetica Neue, Helvetica, Arial;
8+
font-size: 20px;
9+
color:#333;
10+
margin: 50px;
11+
}
12+
code {
13+
color: green;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div>This page will refresh with a coverage report, as long as you have
19+
executed <code>npm run dev</code>. Please be patient.</div>
20+
</body>
21+
</html>

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

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

5+
[![Coverage Status](https://coveralls.io/repos/github/mozilla/source-map/badge.svg)](https://coveralls.io/github/mozilla/source-map)
6+
57
[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map)
68

79
This is a library to generate and consume the source map format

package.json

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,32 @@
5959
},
6060
"license": "BSD-3-Clause",
6161
"scripts": {
62-
"test": "npm run lint && npm run build && node test/run-tests.js",
63-
"build": "webpack --color",
6462
"lint": "eslint *.js lib/ test/",
63+
"prebuild": "npm run lint",
64+
"build": "webpack --color",
65+
"pretest": "npm run build",
66+
"test": "node test/run-tests.js",
67+
"precoverage": "npm run build",
68+
"coverage": "nyc node test/run-tests.js",
69+
"setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true",
70+
"dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage",
71+
"dev:watch": "watch 'npm run coverage' lib/ test/",
72+
"predev": "npm run setup",
73+
"dev": "npm-run-all -p --silent dev:*",
74+
"clean": "rm -rf coverage .nyc_output",
6575
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
6676
},
6777
"devDependencies": {
6878
"doctoc": "^0.15.0",
69-
"webpack": "^3.10",
70-
"eslint": "^4.19.1"
79+
"eslint": "^4.19.1",
80+
"live-server": "^1.2.0",
81+
"npm-run-all": "^4.1.2",
82+
"nyc": "^11.7.1",
83+
"watch": "^1.0.2",
84+
"webpack": "^3.10"
85+
},
86+
"nyc": {
87+
"reporter": "html"
7188
},
7289
"typings": "source-map"
7390
}

0 commit comments

Comments
 (0)