Skip to content

Commit edc3a65

Browse files
committed
Merge lcov reports for CI coverage reporting
1 parent 7fee39d commit edc3a65

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

.github/workflows/ci.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ jobs:
3333
run: npm ci
3434
- name: Lint code
3535
run: npm run lint
36-
- name: Coveralls
37-
uses: coverallsapp/github-action@v1.1.0
38-
with:
39-
github-token: ${{ secrets.github_token }}
4036
- name: Run browser tests in Saucelabs
4137
run: npm run test-ci
4238
timeout-minutes: 5
39+
- name: Install lcov
40+
run: |
41+
sudo apt update
42+
sudo apt install lcov
43+
- name: Merge lcov reports
44+
run: find coverage -name lcov.info -exec echo -a \"{}\" \; | xargs lcov -o coverage/lcov.info
45+
- name: Coveralls
46+
uses: coverallsapp/github-action@master
47+
with:
48+
github-token: ${{ secrets.github_token }}

karma.conf.ci.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ module.exports = function(config) {
101101
},
102102
coverageReporter: {
103103
type: 'lcov',
104-
dir: 'coverage'
104+
dir: 'coverage',
105+
subdir: function(browser) {
106+
return browser.toLowerCase().split(/[ /-]/)[0];
107+
}
105108
},
106109
singleRun: true
107110
});

karma.conf.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,28 @@ module.exports = function(config) {
99
'spec/spec-helper.js',
1010
'spec/*-spec.js'
1111
],
12-
reporters: ['spec'],
1312
port: 9876,
1413
colors: true,
1514
logLevel: config.LOG_INFO,
1615
autoWatch: true,
1716
customLaunchers: {
18-
Chrome_Travis: {
17+
Chrome_No_Sandbox: {
1918
base: 'Chrome',
2019
flags: ['--no-sandbox']
2120
}
2221
},
2322
browsers: ['PhantomJS'],
23+
reporters: ['spec', 'saucelabs', 'coverage', 'coveralls'],
24+
preprocessors: {
25+
'error-stack-parser.js': 'coverage'
26+
},
27+
coverageReporter: {
28+
type: 'lcov',
29+
dir: 'coverage',
30+
subdir: function(browser) {
31+
return browser.toLowerCase().split(/[ /-]/)[0];
32+
}
33+
},
2434
singleRun: false
2535
});
2636
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"scripts": {
5757
"lint": "eslint --fix .",
5858
"test": "karma start karma.conf.js --single-run",
59-
"test-pr": "karma start karma.conf.js --single-run --browsers Firefox,Chrome_Travis",
59+
"test-pr": "karma start karma.conf.js --single-run --browsers Firefox,Chrome_No_Sandbox",
6060
"test-ci": "karma start karma.conf.ci.js --single-run",
6161
"prepare": "cp error-stack-parser.js dist/ && uglifyjs node_modules/stackframe/stackframe.js error-stack-parser.js -o dist/error-stack-parser.min.js --compress --mangle --source-map \"url=error-stack-parser.min.js.map\""
6262
}

0 commit comments

Comments
 (0)