Skip to content
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
21 changes: 12 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: 22
node-version: 24
cache: 'yarn'

- name: Install
Expand Down Expand Up @@ -93,14 +93,14 @@ jobs:
- host: ubuntu-latest
target: wasm32-wasip1-threads
build: yarn build --target wasm32-wasip1-threads
name: stable - ${{ matrix.settings.target }} - node@22
name: stable - ${{ matrix.settings.target }} - node@24
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: 22
node-version: 24
cache: yarn
- name: Install
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -213,8 +213,8 @@ jobs:
target: x86_64-apple-darwin
architecture: x64
node:
- '20'
- '22'
- '22.20.0'
- '24'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -250,8 +250,11 @@ jobs:
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
node:
- '20'
- '22'
- '22.20.0'
- '24'
exclude:
- target: armv7-unknown-linux-gnueabihf
node: '24'
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -315,7 +318,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: 22
node-version: 24
cache: yarn
- name: Install dependencies
run: |
Expand Down Expand Up @@ -350,7 +353,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v5
with:
node-version: 22
node-version: 24
cache: yarn
- name: Install dependencies
run: yarn install
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ After `yarn build/npm run build` command, you can see `package-template.[darwin|

### Test

With [ava](https://github.com/avajs/ava), run `yarn test/npm run test` to testing native addon. You can also switch to another testing framework if you want.
With [`node:test`](https://nodejs.org/api/test.html), run `node --test` to test native addon. You can also switch to another testing framework if you want.

### CI

Expand Down Expand Up @@ -57,15 +57,16 @@ In this package, we choose a better way to solve this problem. We release differ

And you will see:

```bash
$ ava --verbose

✔ sync function from native code
✔ sleep function from native code (201ms)

2 tests passed
✨ Done in 1.12s.
```
✔ sync function from native code (0.342041ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 101.22675
```

## Release package
Expand Down
8 changes: 0 additions & 8 deletions __test__/index.spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions __test__/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions benchmark/tsconfig.json

This file was deleted.

22 changes: 3 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"scripts": {
"artifacts": "napi artifacts",
"bench": "node --import @oxc-node/core/register benchmark/bench.ts",
"bench": "node benchmark/bench.ts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"format": "run-p format:prettier format:rs format:toml",
Expand All @@ -59,7 +59,7 @@
"format:rs": "cargo fmt",
"lint": "oxlint .",
"prepublishOnly": "napi prepublish -t npm",
"test": "ava",
"test": "node --test",
"preversion": "napi build --platform && git add .",
"version": "napi version",
"prepare": "husky"
Expand All @@ -68,11 +68,9 @@
"@emnapi/core": "^1.5.0",
"@emnapi/runtime": "^1.5.0",
"@napi-rs/cli": "^3.2.0",
"@oxc-node/core": "^0.0.32",
"@taplo/cli": "^0.7.0",
"@tybys/wasm-util": "^0.10.0",
"ava": "^6.4.1",
"chalk": "^5.6.2",
"@types/node": "^24.7.0",
"husky": "^9.1.7",
"lint-staged": "^16.1.6",
"npm-run-all2": "^8.0.4",
Expand All @@ -92,20 +90,6 @@
"taplo format"
]
},
"ava": {
"extensions": {
"ts": "module"
},
"timeout": "2m",
"workerThreads": false,
"environmentVariables": {
"OXC_TSCONFIG_PATH": "./__test__/tsconfig.json"
},
"nodeArguments": [
"--import",
"@oxc-node/core/register"
]
},
"prettier": {
"printWidth": 120,
"semi": false,
Expand Down
9 changes: 9 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import test from 'node:test'
import assert from 'node:assert/strict'

import { plus100 } from '../index.js'

test('sync function from native code', () => {
const fixture = 42
assert.equal(plus100(fixture), fixture + 100)
})
File renamed without changes.
18 changes: 9 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"target": "ESNext",
"strict": true,
"moduleResolution": "node",
"module": "CommonJS",
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
"noEmit": true,
"target": "esnext",
"module": "nodenext",
"moduleResolution": "nodenext",
"rewriteRelativeImportExtensions": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true,
"types": ["node"]
},
"include": ["."],
"exclude": ["node_modules", "bench", "__test__"]
"exclude": ["node_modules"]
}
Loading