Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test CI with both Node.js and Bun #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,42 @@ on:
permissions:
contents: read
jobs:
test:
name: Node.js ${{ matrix.node-version }}
test-node:
name: Node.js (${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "16"
- "*"
- "latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
- uses: oven-sh/setup-bun@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v1
bun-version: "1.2.0"
- run: bun install
- run: bun run test # runs tests with Vitest
- uses: codecov/codecov-action@v5
with:
name: Node.js ${{ matrix.node-version }}
name: Node.js (${{ matrix.node-version }})
test-bun:
name: Bun (${{ matrix.bun-version }})
runs-on: ubuntu-latest
strategy:
matrix:
bun-version:
- "1.2.0"
- "latest"
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun-version }}
- run: bun install
- run: bun run test:bun # runs tests with Bun
- uses: codecov/codecov-action@v5
with:
name: Bun (${{ matrix.bun-version }})
10 changes: 8 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

## Installation

```
npm install path-to-regexp --save
Install with your choice of package manager: npm, yarn, or bun.

```sh
npm install path-to-regexp
yarn add path-to-regexp
bun add path-to-regexp
```

## Usage
Expand All @@ -26,6 +30,8 @@ const {
} = require("path-to-regexp");
```

This library is compatible and tested with Node.js 16+ and Bun 1.2+.

### Parameters

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"`).
Expand Down
3 changes: 3 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[test]
coverage = true
coverageReporter = ["text", "lcov"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"prepare": "ts-scripts install && npm run build",
"size": "size-limit",
"specs": "ts-scripts specs",
"test": "ts-scripts test && npm run size"
"test": "ts-scripts test && npm run size",
"test:bun": "bun test && bun run size"
},
"devDependencies": {
"@borderless/ts-scripts": "^0.15.0",
Expand Down