Skip to content

Commit 40f2c95

Browse files
committed
ci: add test workflow
1 parent 4d5b039 commit 40f2c95

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-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/test-reporter@v1.6.0
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

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Npm package version](https://badgen.net/npm/v/@sagold/json-pointer)](https://github.com/sagold/json-pointer/actions/workflows/ci.yaml) [![CI](https://github.com/sagold/json-pointer/actions/workflows/ci.yaml/badge.svg)](https://github.com/sagold/json-pointer/actions/workflows/ci.yaml) ![Types](https://badgen.net/npm/types/json-pointer)
2+
13
<h1 align="left"><img src="./docs/sagold-json-pointer.png" width="100%" alt="@sagold/json-pointer"></h1>
24

35
<p align="left"><b>json-pointer implementation following <a href="https://tools.ietf.org/html/rfc6901">RFC 6901</a> to work with serializable paths into javascript data structures.</b></p>
@@ -290,6 +292,8 @@ console.log(pointer); // output: '/my pointer/to/property'
290292

291293
## Breaking Changes
292294

295+
- 2025/10/27 `v7.2.0`
296+
- changed exports to support esm
293297
- 2025/01/14 with `v7`
294298
- `pointer.set` creates arrays using numbers as properties `/1` when the data is null or an array (previously created objects)
295299
- `pointer.set` creates objects for numbers when using object-syntax `/{1}` (previously unsupported)

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)