Skip to content

Commit 63226a0

Browse files
added unit test framework (#38)
1 parent 58d50ab commit 63226a0

File tree

8 files changed

+7261
-1784
lines changed

8 files changed

+7261
-1784
lines changed

.github/workflows/npm-publish.yml

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

4-
name: Node.js Package
4+
name: Publish Package
55

66
on:
77
release:
88
types: [created]
99

1010
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
16-
with:
17-
node-version: 16
18-
- run: npm ci
19-
2011
publish-npm:
21-
needs: build
2212
runs-on: ubuntu-latest
2313
steps:
2414
- uses: actions/checkout@v2
2515
- uses: actions/setup-node@v2
2616
with:
27-
node-version: 16
17+
node-version: 18
2818
registry-url: https://registry.npmjs.org/
2919
- run: npm ci
3020
- run: npm publish --access public

.github/workflows/pull-request.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 18
16+
- run: npm ci
17+
- run: npm run test

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
test-e2e/
22
.github/
3+
test/

README.MD

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ Before(function () {
4545
this.log(`rp_attribute: random:${Date.now()}`); //dynamic attribute
4646
});
4747
```
48+
### Run Unit Tests
49+
add token.json file with rp token and other config
50+
run
51+
`npm run test`
4852

49-
### Run E2E Test
53+
### Run E2E Tests
5054
add token.json file with rp token and other config
5155
run
5256
`npm run test-e2e`

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class RPFormatter extends Formatter {
1010

1111
constructor(options) {
1212
super(options);
13-
const rpEnable = options.parsedArgvOptions.rpConfig.enable;
13+
const rpEnable = options.parsedArgvOptions?.rpConfig?.enable;
1414
if (rpEnable !== undefined && !rpEnable) return undefined;
1515
options.eventBroadcaster.on('envelope', this.processEnvelope.bind(this));
1616
this.rpConfig = options.parsedArgvOptions.rpConfig;

0 commit comments

Comments
 (0)