Skip to content

Commit 5d77541

Browse files
author
Scott Hardy
authored
Merge pull request #124 from GameBridgeAI/add_test_coverage_profiles
update test scripts with coverage profiles
2 parents cdb742b + d4078d4 commit 5d77541

11 files changed

Lines changed: 79 additions & 43 deletions

File tree

.github/workflows/ts_serialize_release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,21 @@ jobs:
3131
- name: Cache Dependencies
3232
run: deno cache test_deps.ts
3333

34-
- name: Run Deno Tests
35-
run: deno test
34+
- name: Run Deno Tests with coverage
35+
run: deno test --coverage=coverage --unstable
36+
37+
- name: lcov test coverage
38+
run: deno coverage --unstable coverage --lcov > coverage.lcov
39+
if: matrix.os == 'ubuntu-latest'
40+
41+
- name: Report code coverage
42+
uses: zgosalvez/github-actions-report-lcov@v1
43+
with:
44+
coverage-files: coverage.lcov
45+
minimum-coverage: 100
46+
artifact-name: code-coverage-report
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
if: matrix.os == 'ubuntu-latest'
3649

3750
- name: Run package.json Generation Tests
3851
run: .github/workflows/scripts/npm_release_files/create_npm_package_file_test.sh

.github/workflows/ts_serialize_tests.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,21 @@ jobs:
3636
- name: Cache Dependencies
3737
run: deno cache test_deps.ts
3838

39-
- name: Run Deno Tests
40-
run: deno test
39+
- name: Run Deno Tests with coverage
40+
run: deno test --coverage=coverage --unstable
41+
42+
- name: lcov test coverage
43+
run: deno coverage --unstable coverage --lcov > coverage.lcov
44+
if: matrix.os == 'ubuntu-latest'
45+
46+
- name: Report code coverage
47+
uses: zgosalvez/github-actions-report-lcov@v1
48+
with:
49+
coverage-files: coverage.lcov
50+
minimum-coverage: 100
51+
artifact-name: code-coverage-report
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
if: matrix.os == 'ubuntu-latest'
4154

4255
- name: Run package.json Generation Tests
4356
run: .github/workflows/scripts/npm_release_files/create_npm_package_file_test.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ examples/node/*
55
!examples/node/tsconfig.json
66
!examples/node/package.json
77
!examples/node/README.md
8+
coverage
9+
coverage.lcov
810
.DS_Store

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "deno.enable": true }
1+
{ "deno.enable": true }

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [unreleased]
10+
11+
## Added
12+
13+
- ci with test coverage
14+
- ci fails to build if we do not have 100% test coverage
15+
- GitHub actions reports on the PR with coverage reports
16+
917
## [v1.3.0] - 2021-02-25
1018

1119
### Changed

docs/blog.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ First, a JSON User document:
2121

2222
```json
2323
{
24-
"first_name": "Theodore",
25-
"last_name": "Esquire",
26-
"created_date": "2020-09-24T00:00:00.000Z"
24+
"first_name": "Theodore",
25+
"last_name": "Esquire",
26+
"created_date": "2020-09-24T00:00:00.000Z"
2727
}
2828
```
2929

examples/deno/tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
}
5-
}
2+
"compilerOptions": {
3+
"experimentalDecorators": true
4+
}
5+
}

examples/fixtures/from.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"serializedPropertyNoArg": "fromJSON",
3-
"rename_test": "fromJSON",
4-
"rename_test_by_property": "fromJSON",
5-
"fromJSONStrategyTest": "fromJSON",
6-
"toJSONStrategyTest": "fromJSON",
7-
"composeStrategyTest": "fromJSON",
8-
"asTest":{
9-
"sub_property": "fromJSON"
10-
},
11-
"isoDate": "2020-06-04T19:01:47.831Z",
12-
"createDate": "2099-11-25"
13-
}
2+
"serializedPropertyNoArg": "fromJSON",
3+
"rename_test": "fromJSON",
4+
"rename_test_by_property": "fromJSON",
5+
"fromJSONStrategyTest": "fromJSON",
6+
"toJSONStrategyTest": "fromJSON",
7+
"composeStrategyTest": "fromJSON",
8+
"asTest": {
9+
"sub_property": "fromJSON"
10+
},
11+
"isoDate": "2020-06-04T19:01:47.831Z",
12+
"createDate": "2099-11-25"
13+
}

examples/fixtures/to.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"serializedPropertyNoArg": "toJSON",
3-
"rename_test": "toJSON",
4-
"rename_test_by_property": "toJSON",
5-
"fromJSONStrategyTest": "toJSON",
6-
"toJSONStrategyTest": "toJSON strategy changed",
7-
"composeStrategyTest": "toJSON strategy changed",
8-
"asTest":{
9-
"sub_property": "toJSON"
10-
},
11-
"isoDate": "2020-06-04T19:01:47.831Z",
12-
"createDate": "2099-11-25T00:00:00.000Z"
13-
}
2+
"serializedPropertyNoArg": "toJSON",
3+
"rename_test": "toJSON",
4+
"rename_test_by_property": "toJSON",
5+
"fromJSONStrategyTest": "toJSON",
6+
"toJSONStrategyTest": "toJSON strategy changed",
7+
"composeStrategyTest": "toJSON strategy changed",
8+
"asTest": {
9+
"sub_property": "toJSON"
10+
},
11+
"isoDate": "2020-06-04T19:01:47.831Z",
12+
"createDate": "2099-11-25T00:00:00.000Z"
13+
}

examples/node/tsconfig.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
"resolveJsonModule": true,
5-
"esModuleInterop": true,
6-
}
7-
}
2+
"compilerOptions": {
3+
"experimentalDecorators": true,
4+
"resolveJsonModule": true,
5+
"esModuleInterop": true
6+
}
7+
}

0 commit comments

Comments
 (0)