Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 96f3789

Browse files
authored
Merge pull request #75 from segmentio/coverage
setup codecov.io
2 parents 54d2011 + 665649f commit 96f3789

File tree

7 files changed

+103
-37
lines changed

7 files changed

+103
-37
lines changed

.circleci/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ jobs:
1616
- run: make test
1717
- store_test_results:
1818
path: junit-reports
19+
coverage:
20+
docker:
21+
- image: circleci/node:8-browsers
22+
steps:
23+
- checkout
24+
- run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
25+
- restore_cache:
26+
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
27+
- run: yarn install --frozen-lockfile
28+
- save_cache:
29+
key: yarn-dependency-cache-{{ checksum "yarn.lock" }}
30+
paths:
31+
- node_modules
32+
- run: yarn run karma start karma.conf.coverage.js
33+
- store_test_results:
34+
path: junit-reports
35+
- run: yarn run codecov
1936
publish:
2037
docker:
2138
- image: circleci/node:8-browsers
@@ -31,6 +48,10 @@ workflows:
3148
filters:
3249
tags:
3350
only: /.*/
51+
- coverage:
52+
filters:
53+
tags:
54+
only: /.*/
3455
- deploy:
3556
requires:
3657
- test

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ test-browser: install
7474
# Default test target.
7575
test: lint test-browser
7676
.PHONY: test
77+
7778
.DEFAULT_GOAL = test

karma.conf.ci.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ module.exports = function(config) {
5858
baseConfig(config);
5959

6060
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
61-
throw new Error('SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are required but are missing');
61+
throw new Error(
62+
'SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are required but are missing'
63+
);
6264
}
6365

6466
config.set({
@@ -80,24 +82,17 @@ module.exports = function(config) {
8082
suppressPassed: true
8183
},
8284

83-
browsers: ['PhantomJS'].concat(Object.keys(customLaunchers)),
84-
85-
customLaunchers: customLaunchers,
86-
8785
junitReporter: {
8886
outputDir: 'junit-reports',
8987
suite: require('./package.json').name
9088
},
9189

90+
browsers: ['PhantomJS'].concat(Object.keys(customLaunchers)),
91+
92+
customLaunchers: customLaunchers,
93+
9294
sauceLabs: {
9395
testName: require('./package.json').name
9496
}
95-
96-
// Edge and Safari 9 still panic with coverage. Keeping disabled.
97-
// coverageReporter: {
98-
// reporters: [
99-
// { type: 'lcov' }
100-
// ]
101-
// }
10297
});
10398
};

karma.conf.coverage.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* eslint-env node */
2+
'use strict';
3+
4+
var baseConfig = require('./karma.conf');
5+
6+
module.exports = function(config) {
7+
baseConfig(config);
8+
9+
config.set({
10+
singleRun: true,
11+
12+
reporters: ['spec', 'summary', 'junit', 'coverage'],
13+
14+
specReporter: {
15+
suppressPassed: true
16+
},
17+
18+
junitReporter: {
19+
outputDir: 'junit-reports',
20+
suite: require('./package.json').name
21+
},
22+
23+
coverageReporter: {
24+
reporters: [
25+
{ type: 'lcovonly', subdir: '.' },
26+
{ type: 'json', subdir: '.' }
27+
]
28+
},
29+
30+
browserify: {
31+
debug: true,
32+
transform: [
33+
[
34+
'browserify-istanbul',
35+
{
36+
instrumenterConfig: {
37+
embedSource: true
38+
}
39+
}
40+
]
41+
]
42+
}
43+
});
44+
};

karma.conf.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ module.exports = function(config) {
55
config.set({
66
files: [
77
{ pattern: 'test/support/*.html', included: false },
8-
// NOTE: This must run before all tests
9-
'test/support/global.js',
8+
'test/support/global.js', // NOTE: This must run before all tests
109
'test/**/*.test.js'
1110
],
1211

1312
browsers: ['PhantomJS'],
1413

1514
frameworks: ['browserify', 'mocha'],
1615

17-
reporters: ['spec'/* , 'coverage' */],
16+
reporters: ['spec'],
1817

1918
preprocessors: {
2019
'test/**/*.js': 'browserify'
@@ -28,26 +27,6 @@ module.exports = function(config) {
2827

2928
browserify: {
3029
debug: true
31-
// Edge and Safari 9 still panic with coverage. Keeping disabled.
32-
// transform: [
33-
// [
34-
// 'browserify-istanbul',
35-
// {
36-
// instrumenterConfig: {
37-
// embedSource: true
38-
// }
39-
// }
40-
// ]
41-
// ]
4230
}
43-
44-
// Edge and Safari 9 still panic with coverage. Keeping disabled.
45-
// coverageReporter: {
46-
// reporters: [
47-
// { type: 'text' },
48-
// { type: 'html' },
49-
// { type: 'json' }
50-
// ]
51-
// }
5231
});
5332
};

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@
7474
"@segment/analytics.js-integration": "^3.2.1",
7575
"@segment/eslint-config": "^3.1.1",
7676
"browserify": "13.0.0",
77+
"browserify-istanbul": "^2.0.0",
78+
"codecov": "^3.0.2",
7779
"compat-trigger-event": "^1.0.0",
7880
"component-each": "^0.2.6",
7981
"eslint": "^2.9.0",
8082
"eslint-config-prettier": "^2.9.0",
8183
"eslint-plugin-mocha": "^2.2.0",
8284
"eslint-plugin-require-path-exists": "^1.1.5",
8385
"husky": "^0.14.3",
86+
"istanbul": "^0.4.3",
8487
"jquery": "^3.2.1",
8588
"karma": "1.3.0",
8689
"karma-browserify": "^5.0.4",

yarn.lock

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ argparse@^1.0.7:
368368
dependencies:
369369
sprintf-js "~1.0.2"
370370

371+
argv@0.0.2:
372+
version "0.0.2"
373+
resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab"
374+
371375
arr-diff@^2.0.0:
372376
version "2.0.0"
373377
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
@@ -707,6 +711,13 @@ browserify-des@^1.0.0:
707711
des.js "^1.0.0"
708712
inherits "^2.0.1"
709713

714+
browserify-istanbul@^2.0.0:
715+
version "2.0.0"
716+
resolved "https://registry.yarnpkg.com/browserify-istanbul/-/browserify-istanbul-2.0.0.tgz#85a4b425da1f7c09e02ba32a3b44f6535d38c257"
717+
dependencies:
718+
minimatch "^3.0.0"
719+
through "^2.3.8"
720+
710721
browserify-rsa@^4.0.0:
711722
version "4.0.1"
712723
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524"
@@ -1091,6 +1102,14 @@ code-point-at@^1.0.0:
10911102
version "1.1.0"
10921103
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
10931104

1105+
codecov@^3.0.2:
1106+
version "3.0.2"
1107+
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.2.tgz#aea43843a5cd2fb6b7e488b2eff25d367ab70b12"
1108+
dependencies:
1109+
argv "0.0.2"
1110+
request "^2.81.0"
1111+
urlgrey "0.4.4"
1112+
10941113
collection-visit@^1.0.0:
10951114
version "1.0.0"
10961115
resolved "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"
@@ -3021,7 +3040,7 @@ isstream@~0.1.2:
30213040
version "0.1.2"
30223041
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
30233042

3024-
istanbul@^0.4.0:
3043+
istanbul@^0.4.0, istanbul@^0.4.3:
30253044
version "0.4.5"
30263045
resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
30273046
dependencies:
@@ -5353,7 +5372,7 @@ through2@^2.0.0:
53535372
readable-stream "^2.1.5"
53545373
xtend "~4.0.1"
53555374

5356-
"through@>=2.2.7 <3", through@^2.3.6:
5375+
"through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8:
53575376
version "2.3.8"
53585377
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
53595378

@@ -5565,6 +5584,10 @@ url@~0.11.0:
55655584
punycode "1.3.2"
55665585
querystring "0.2.0"
55675586

5587+
urlgrey@0.4.4:
5588+
version "0.4.4"
5589+
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
5590+
55685591
use@^3.1.0:
55695592
version "3.1.0"
55705593
resolved "https://registry.npmjs.org/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544"

0 commit comments

Comments
 (0)