Skip to content

Commit 196aafb

Browse files
authored
Fix coverage reporting when tests fail; also push to codecov (#1047)
* Try pushing to codecov; maybe that'll work better * fix * fix * fix * fix * fix * fix * fix * fix * fix
1 parent 9840cb1 commit 196aafb

File tree

3 files changed

+44
-14
lines changed

3 files changed

+44
-14
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,54 @@ jobs:
3333

3434
test:
3535
needs: lint-build
36-
name: "Test #${{ matrix.flavor }}: ${{ matrix.os }}, node v${{ matrix.node }}, ${{ matrix.typescript }}"
37-
runs-on: ${{ matrix.os }}
36+
name: "Test: ${{ matrix.os }}, node ${{ matrix.node }}, TS ${{ matrix.typescript }}"
37+
runs-on: ${{ matrix.os }}-latest
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
os: [ubuntu-latest, windows-latest]
41+
os: [ubuntu, windows]
4242
flavor: [1, 2, 3, 4, 5, 6, 7, 8]
4343
include:
4444
- flavor: 1
4545
node: 10
46-
typescript: typescript@latest
46+
nodeFlag: 10
47+
typescript: latest
48+
typescriptFlag: latest
4749
- flavor: 2
4850
node: 12
49-
typescript: typescript@latest
51+
nodeFlag: 12
52+
typescript: latest
53+
typescriptFlag: latest
5054
- flavor: 3
5155
node: 13
52-
typescript: typescript@latest
56+
nodeFlag: 13
57+
typescript: latest
58+
typescriptFlag: latest
5359
- flavor: 4
5460
node: 13
55-
typescript: [email protected]
61+
nodeFlag: 13
62+
typescript: 2.7
63+
typescriptFlag: 2_7
5664
- flavor: 5
5765
node: 13
58-
typescript: typescript@next
66+
nodeFlag: 13
67+
typescript: next
68+
typescriptFlag: next
5969
- flavor: 6
6070
node: 14
61-
typescript: typescript@latest
71+
nodeFlag: 14
72+
typescript: latest
73+
typescriptFlag: latest
6274
- flavor: 7
6375
node: 14
64-
typescript: [email protected]
76+
nodeFlag: 14
77+
typescript: 2.7
78+
typescriptFlag: 2_7
6579
- flavor: 8
6680
node: 14
67-
typescript: typescript@next
81+
nodeFlag: 14
82+
typescript: next
83+
typescriptFlag: next
6884
steps:
6985
# checkout code
7086
- uses: actions/checkout@v2
@@ -81,14 +97,22 @@ jobs:
8197
with:
8298
name: ts-node-packed.tgz
8399
path: tests/
84-
- run: npm install ${{ matrix.typescript }} --force
100+
- run: npm install typescript@${{ matrix.typescript }} --force
85101
- run: npm run test-cov
102+
- run: npm run coverage-report
103+
if: ${{ always() }}
104+
- name: Codecov
105+
if: ${{ always() }}
106+
uses: codecov/codecov-action@v1
107+
with:
108+
flags: ${{ matrix.os }},node_${{ matrix.nodeFlag }},typescript_${{ matrix.typescriptFlag }}
109+
- run: npm run coverage-fix-paths
110+
- run: npm run coverage-report
86111
- name: Coveralls
87112
if: ${{ always() }}
88113
uses: coverallsapp/github-action@master
89114
with:
90115
github-token: ${{ secrets.github_token }}
91-
flag-name: run-${{ matrix.os }}-${{ matrix.flavor }}
92116
parallel: true
93117
finish:
94118
needs: test

codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fixes:
2+
# Remap from npm-installed ts-node to root of project
3+
# This can take the place of ./scripts/rewrite-coverage-paths.js
4+
- "tests/node_modules/ts-node/::"

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
"build-configSchema": "typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema",
3030
"build-pack": "node ./scripts/build-pack.js",
3131
"test-spec": "mocha dist/**/*.spec.js -R spec --bail",
32-
"test-cov": "nyc mocha -- \"dist/**/*.spec.js\" -R spec --bail && node ./scripts/rewrite-coverage-paths.js && nyc report --reporter=lcov",
32+
"test-cov": "nyc mocha -- \"dist/**/*.spec.js\" -R spec --bail",
3333
"test": "npm run build && npm run lint && npm run test-cov",
34+
"coverage-fix-paths": "node ./scripts/rewrite-coverage-paths.js",
35+
"coverage-report": "nyc report --reporter=lcov",
3436
"prepare": "npm run build-nopack"
3537
},
3638
"engines": {

0 commit comments

Comments
 (0)