Skip to content

Commit 6fcac11

Browse files
committed
ci: add test workflow
1 parent 4d5b039 commit 6fcac11

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, next, workflow]
6+
pull_request:
7+
branches: [main, next]
8+
9+
jobs:
10+
install:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Install yarn (required locally)
15+
run: npm install --global yarn
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: "22"
19+
cache: "yarn"
20+
- name: Install dependencies
21+
run: yarn install --frozen-lockfile
22+
23+
run-unit-tests:
24+
runs-on: ubuntu-latest
25+
needs: install
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile
30+
- name: Run unit tests
31+
run: yarn test:ci
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: test-results-unit-tests
35+
path: test-result-unit.json
36+
- uses: dorny/[email protected]
37+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
38+
with:
39+
name: test-results / unit-tests
40+
path: test-result-unit.json
41+
reporter: mocha-json

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.sublime-project
22
*.sublime-workspace
3+
test*.json
34
.DS_STORE
45
/.nyc_output
56
dev

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Thumbs.db
1717
tsconfig.json
1818
webpack.config.js
1919
yarn-error.log
20+
.github

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"scripts": {
2424
"dist": "rm -rf dist; tsdown -f esm -f cjs -f iife --minify; mv dist/index.iife.js dist/jsonPointer.js",
2525
"test": "TS_NODE_PROJECT=./test/tsconfig.json mocha 'test/**/*.test.ts'",
26+
"test:ci": "TS_NODE_PROJECT=./test/tsconfig.json DISABLE_LOG=true mocha -R json 'test/**/*.test.ts' > test-result-unit.json; exit 0",
2627
"prepublishOnly": "yarn test && yarn dist",
2728
"lint": "eslint lib && tsc",
2829
"coverage": "nyc yarn test"

0 commit comments

Comments
 (0)