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

Commit f70990f

Browse files
author
Benjamin E. Coe
authored
build: add GitHub actions config for unit tests (#827)
1 parent bfbd3f1 commit f70990f

4 files changed

Lines changed: 67 additions & 11 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
name: ci
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node: [8, 10, 12, 13]
13+
steps:
14+
- uses: actions/checkout@v1
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node }}
18+
- run: node --version
19+
- run: npm install
20+
- run: npm test
21+
windows:
22+
runs-on: windows-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- uses: actions/setup-node@v1
26+
with:
27+
node-version: 12
28+
- run: npm install
29+
- run: npm test
30+
lint:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v1
34+
- uses: actions/setup-node@v1
35+
with:
36+
node-version: 12
37+
- run: npm install
38+
- run: npm run lint
39+
docs:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v1
43+
- uses: actions/setup-node@v1
44+
with:
45+
node-version: 12
46+
- run: npm install
47+
- run: npm run docs-test
48+
coverage:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v1
52+
- uses: actions/setup-node@v1
53+
with:
54+
node-version: 12
55+
- run: npm install
56+
- run: npm test
57+
- run: ./node_modules/.bin/c8 report --reporter=text-lcov | npx codecov@3 -t ${{ secrets.CODECOV_TOKEN }} --pipe

package.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,21 @@
2626
],
2727
"scripts": {
2828
"prepare": "npm run compile",
29-
"presamples-test": "npm run compile",
3029
"samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../",
3130
"presystem-test": "npm run compile",
3231
"system-test": "mocha build/system-test --timeout 600000",
33-
"test-no-cover": "cross-env CLOUD_DEBUG_ASSERTIONS=1 mocha build/test --timeout 4000 --R spec",
34-
"test": "nyc npm run test-no-cover && nyc report",
35-
"check": "gts check",
36-
"clean": "gts clean",
32+
"test": "cross-env CLOUD_DEBUG_ASSERTIONS=1 mocha build/test",
3733
"precompile": "npm run compile-scripts && node build/scripts/setup-build-dir.js",
3834
"compile": "tsc -p .",
3935
"compile-scripts": "tsc -p scripts-tsconfig.json",
4036
"fix": "gts fix",
4137
"pretest": "npm run compile",
42-
"posttest": "npm run check && npm run license-check",
4338
"prepack": "npm run compile",
44-
"license-check": "jsgl --local .",
45-
"lint": "npm run check",
39+
"lint": "gts check",
4640
"docs": "compodoc src/",
4741
"docs-test": "linkinator docs",
48-
"predocs-test": "npm run docs"
42+
"predocs-test": "npm run docs",
43+
"prelint": "cd samples; npm link ../; npm i"
4944
},
5045
"dependencies": {
5146
"@google-cloud/common": "^2.0.0",
@@ -82,7 +77,6 @@
8277
"cross-env": "^7.0.0",
8378
"execa": "^4.0.0",
8479
"gts": "^1.0.0",
85-
"js-green-licenses": "^1.0.0",
8680
"linkinator": "^2.0.0",
8781
"mkdirp": "^0.5.1",
8882
"mocha": "^7.0.0",

src/agent/util/debug-assert.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export interface FakeAssert {
3232
rejects: Function;
3333
doesNotReject: Function;
3434
strict: Function;
35+
match: Function;
36+
doesNotMatch: Function;
3537
}
3638

3739
const nop = (_: {}) => _;
@@ -54,6 +56,8 @@ const fakeAssert: FakeAssert = {
5456
rejects: nop,
5557
doesNotReject: nop,
5658
strict: nop,
59+
match: nop,
60+
doesNotMatch: nop,
5761
};
5862

5963
export function debugAssert(enableAssertions: boolean): FakeAssert {

test/test-debug-assert.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ describe('debug-assert', () => {
3434
Object.keys(realAssert).forEach(key => {
3535
realAssert.strictEqual(
3636
typeof ((assert as {}) as {[key: string]: Function})[key],
37-
'function'
37+
'function',
38+
`${key} does not exist on the debug assert library`
3839
);
3940
});
4041
});

0 commit comments

Comments
 (0)