Skip to content

Commit 8903fec

Browse files
committed
Add Bun as a test platform in CI
1 parent 39e861d commit 8903fec

File tree

4 files changed

+42
-17
lines changed

4 files changed

+42
-17
lines changed

Diff for: .github/workflows/ci.yml

+29-14
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,42 @@ on:
55
permissions:
66
contents: read
77
jobs:
8-
test:
9-
name: Node.js ${{ matrix.node-version }}
8+
test-node:
9+
name: Node.js (${{ matrix.node-version }})
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
1313
node-version:
1414
- "16"
15-
- "*"
15+
- "latest"
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
1919
with:
2020
node-version: ${{ matrix.node-version }}
21-
- uses: actions/cache@v2
21+
- uses: oven-sh/setup-bun@v2
2222
with:
23-
path: ~/.npm
24-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
25-
restore-keys: |
26-
${{ runner.os }}-node-
27-
- run: npm ci
28-
- run: npm test
29-
- uses: codecov/codecov-action@v1
23+
bun-version: "1.2.0"
24+
- run: bun install
25+
- run: bun run test # runs tests with Vitest
26+
- uses: codecov/codecov-action@v5
3027
with:
31-
name: Node.js ${{ matrix.node-version }}
28+
name: Node.js (${{ matrix.node-version }})
29+
test-bun:
30+
name: Bun (${{ matrix.bun-version }})
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
bun-version:
35+
- "1.2.0"
36+
- "latest"
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: oven-sh/setup-bun@v2
40+
with:
41+
bun-version: ${{ matrix.bun-version }}
42+
- run: bun install
43+
- run: bun run test:bun # runs tests with Bun
44+
- uses: codecov/codecov-action@v5
45+
with:
46+
name: Bun (${{ matrix.bun-version }})

Diff for: Readme.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
## Installation
1212

13-
```
14-
npm install path-to-regexp --save
13+
Install with your choice of package manager: npm, yarn, or bun.
14+
15+
```sh
16+
npm install path-to-regexp
17+
yarn add path-to-regexp
18+
bun add path-to-regexp
1519
```
1620

1721
## Usage
@@ -26,6 +30,8 @@ const {
2630
} = require("path-to-regexp");
2731
```
2832

33+
This library is compatible and tested with Node.js 16+ and Bun 1.2+.
34+
2935
### Parameters
3036

3137
Parameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:"param-name"`).

Diff for: bunfig.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[test]
2+
coverage = true
3+
coverageReporter = ["text", "lcov"]

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"prepare": "ts-scripts install && npm run build",
2828
"size": "size-limit",
2929
"specs": "ts-scripts specs",
30-
"test": "ts-scripts test && npm run size"
30+
"test": "ts-scripts test && npm run size",
31+
"test:bun": "bun test && bun run size"
3132
},
3233
"devDependencies": {
3334
"@borderless/ts-scripts": "^0.15.0",

0 commit comments

Comments
 (0)