Skip to content

Commit daf7da4

Browse files
authored
Merge pull request #12 from linux-nerd/feature/add-coverage-report
Feature/add coverage report
2 parents 83e0df0 + e61af85 commit daf7da4

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules/
2-
lib/
2+
lib/
3+
coverage/
4+
npm-debug.log

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ sudo: false
44
dist: trusty
55
node_js:
66
- "6.9.1"
7-
addons:
8-
apt:
9-
sources:
10-
- google-chrome
11-
packages:
12-
- google-chrome-stable
7+
# addons:
8+
# apt:
9+
# sources:
10+
# - google-chrome
11+
# packages:
12+
# - google-chrome-stable
1313
# firefox: "38.0"
1414
#apt:
1515
#sources:
@@ -32,4 +32,5 @@ install:
3232
script:
3333
- npm run test:travis
3434
# Excluding build process as of now
35-
#- npm run build
35+
#- npm run build
36+
after_success: 'npm run coveralls'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Data Structures in Javascript
55
-----------------------------
66
![Build Status](https://travis-ci.org/linux-nerd/data-structures.js.svg?branch=master)
7+
[![Coverage Status](https://coveralls.io/repos/github/linux-nerd/data-structures.js/badge.svg)](https://coveralls.io/github/linux-nerd/data-structures.js)
78

89
# Background
910
There are neither a lot of resources on internet nor any book which guides and dictates best practices in the implementation of popular Data Structures using Javascript. The purpose of this library is to provide cooked implementation of populare data structures in javascript.

karma.conf.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ module.exports = function (config) {
3535
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
3636
preprocessors: {
3737
'src/**/*.spec.js': ['webpack'],
38-
'src/**/*.js': ['webpack']
38+
'src/**/*.js': ['webpack', 'coverage']
3939
},
4040

4141

4242
// test results reporter to use
4343
// possible values: 'dots', 'progress'
4444
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
45-
reporters: ['progress'],
45+
reporters: ['progress', 'coverage'],
4646

4747

4848
// web server port
@@ -69,7 +69,11 @@ module.exports = function (config) {
6969

7070
// Continuous Integration mode
7171
// if true, Karma captures browsers, runs the tests and exits
72-
singleRun: false
72+
singleRun: false,
73+
coverageReporter: {
74+
type: 'lcov',
75+
dir: 'coverage/',
76+
}
7377
};
7478

7579
//workaround for travis

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "SET WEBPACK_ENV=build && webpack",
88
"dev": "SET WEBPACK_ENV=dev & webpack --progress --colors --watch",
99
"test": "SET WEBPACK_ENV=dev & karma start",
10-
"test:travis": "SET WEBPACK_ENV=dev & karma start --single-run"
10+
"test:travis": "SET WEBPACK_ENV=dev & karma start --single-run",
11+
"coveralls": "cat ./coverage/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
1112
},
1213
"keywords": [],
1314
"author": "",
@@ -20,11 +21,14 @@
2021
"babel-plugin-add-module-exports": "0.1.2",
2122
"babel-polyfill": "^6.26.0",
2223
"babel-preset-latest": "^6.24.1",
24+
"coveralls": "^3.0.0",
2325
"eslint": "1.7.2",
2426
"eslint-loader": "1.1.0",
27+
"istanbul": "^0.4.5",
2528
"jasmine-core": "^2.8.0",
2629
"karma": "^1.7.1",
2730
"karma-chrome-launcher": "^2.2.0",
31+
"karma-coverage": "^1.1.1",
2832
"karma-jasmine": "^1.1.0",
2933
"karma-phantomjs-launcher": "^1.0.4",
3034
"karma-webpack": "^2.0.4",
@@ -33,4 +37,4 @@
3337
"uglifyjs-webpack-plugin": "^0.4.6",
3438
"webpack": "1.12.9"
3539
}
36-
}
40+
}

0 commit comments

Comments
 (0)