Skip to content

Commit 5a6bb88

Browse files
authored
Merge pull request #50 from cortex-lab/coverage
Added coverage
2 parents 3edec0a + 7aa45f5 commit 5a6bb88

File tree

9 files changed

+1249
-50
lines changed

9 files changed

+1249
-50
lines changed

CHANGELOG.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22

3-
## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [2.1.0]
3+
## [Latest](https://github.com/cortex-lab/matlab-ci/commits/master) [2.2.0]
4+
5+
## Added
6+
- nyc dependency for manual coverage of matlab-ci
7+
8+
## Modified
9+
10+
- removed old dependencies
11+
- support for short ids and branch names for all endpoints
12+
13+
## [2.1.0]
414

515
### Modified
616
- More generic handling of submodules

README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# MATLAB-ci
22
[![Build Status](https://travis-ci.com/cortex-lab/matlab-ci.svg?branch=master)](https://travis-ci.com/cortex-lab/matlab-ci)
3+
[![Coverage](https://img.shields.io/badge/coverage-81.07-green)](https://img.shields.io/badge/coverage-72.35-yellowgreen)
34

45
A small set of modules written in Node.js for running automated tests of MATLAB code in response to GitHub events. Also submits code coverage to the Coveralls API.
56

67
Currently unsupported:
78
* Running tests on forked repositories
8-
* Testing multiple repos (unless they are submodules)
9+
* Testing multiple repos (unless they are submodules)
910

1011
## Getting Started
1112

@@ -59,9 +60,18 @@ chmod u+x ./prep_env.BAT
5960
```
6061

6162
## Running the tests
62-
63+
Before running the tests ensure the dev dependencies are installed.
64+
On Windows:
65+
```
66+
set "DOTENV_CONFIG_PATH=./test/fixtures/.env.test" & npm test
67+
```
68+
On Linux:
69+
```
70+
DOTENV_CONFIG_PATH=./test/fixtures/.env.test & npm test
71+
```
72+
Coverage:
6373
```
64-
mocha ./test
74+
DOTENV_CONFIG_PATH=./test/fixtures/.env.test & npm run coverage
6575
```
6676

6777
## Deployment

lib.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function compareCoverage(job) {
330330
}
331331
log('Comparing coverage for %g -> %g', job.data.sha, job.data.base);
332332
var records;
333-
if (!job.coverage) {
333+
if (!job.data.coverage) {
334334
log('No coverage in job data; loading from records');
335335
records = loadTestRecords([job.data.sha, job.data.base]);
336336
// Filter duplicates just in case
@@ -341,7 +341,7 @@ function compareCoverage(job) {
341341
records = [curr, loadTestRecords(job.data.base)];
342342
}
343343
log('The following records were found: %O', records);
344-
const has_coverage = records.every(o => (typeof o.coverage !== 'undefined' && o.coverage > 0));
344+
const hasCoverage = records.every(o => (o.coverage > 0));
345345

346346
// Check if any errored or failed to update coverage
347347
if (records.filter(o => o.status === 'error').length > 0) {
@@ -350,7 +350,7 @@ function compareCoverage(job) {
350350
job.data.description = 'Failed to determine coverage as tests incomplete due to errors';
351351

352352
// Both records present and they have coverage
353-
} else if (records.length === 2 && has_coverage) {
353+
} else if (records.length === 2 && hasCoverage) {
354354
log('Calculating coverage difference');
355355
// Ensure first record is for head commit
356356
if (records[0].commit === job.data.base) { records.reverse() }

0 commit comments

Comments
 (0)