Skip to content
Merged
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
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@ on:

jobs:
ci:
name: CI (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
name: CI (Node ${{ matrix.version }}-${{ matrix.os }})
strategy:
fail-fast: false
matrix:
node-version:
- '22'
- '24.11.1'
os: [ubuntu-latest, windows-latest]
version: ['22.17.0', '24.11.1']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
- name: Setup Node
uses: actions/setup-node@v4.3.0
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.version }}
- name: Install Dependencies
run: npm ci
- name: Save error log
Expand Down
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"cycles": "madge src --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json",
"prettier": "prettier -w .",
"prettier:check": "prettier --check .",
"test": "KNIGHTED_JSX_CLI_TEST=1 vitest run --coverage",
"test:watch": "KNIGHTED_JSX_CLI_TEST=1 vitest",
"test": "cross-env KNIGHTED_JSX_CLI_TEST=1 vitest run --coverage",
"test:watch": "cross-env KNIGHTED_JSX_CLI_TEST=1 vitest",
"test:e2e": "npm run build && npm run setup:wasm && npm run build:fixture && playwright test",
"build:fixture": "node scripts/build-rspack-fixture.mjs",
"demo:node-ssr": "node test/fixtures/node-ssr/render.mjs",
Expand All @@ -149,6 +149,7 @@
"@types/react-dom": "^19.2.3",
"@vitest/coverage-v8": "^4.0.14",
"@vitest/eslint-plugin": "^1.6.4",
"cross-env": "^10.1.0",
"eslint": "^9.39.1",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-playwright": "^2.4.0",
Expand Down
28 changes: 14 additions & 14 deletions scripts/setup-wasm.mjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { execFileSync, spawnSync } from 'node:child_process'
import { execFileSync } from 'node:child_process'
import fs from 'node:fs'
import path from 'node:path'
import { extract } from 'tar'

const npmExecPath = process.env.npm_execpath
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm'
const PACKAGE_SPEC =
process.env.WASM_BINDING_PACKAGE ?? '@oxc-parser/binding-wasm32-wasi@^0.99.0'
process.env.WASM_BINDING_PACKAGE ?? '@oxc-parser/binding-wasm32-wasi@^0.105.0'
const cwd = process.cwd()
const cliEntry = path.resolve(cwd, 'dist', 'cli', 'init.js')

if (fs.existsSync(cliEntry)) {
const result = spawnSync(process.execPath, [cliEntry, '--skip-config', '--force'], {
cwd,
stdio: 'inherit',
})

process.exit(result.status ?? 0)
}

function runNpmPack() {
const output = execFileSync('npm', ['pack', PACKAGE_SPEC], {
const baseOptions = {
cwd,
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'inherit'],
}).trim()
}
const output = (
npmExecPath
? execFileSync(process.execPath, [npmExecPath, 'pack', PACKAGE_SPEC], baseOptions)
: execFileSync(npmBin, ['pack', PACKAGE_SPEC], {
...baseOptions,
shell: process.platform === 'win32',
})
).trim()
const lines = output.split('\n').filter(Boolean)

return lines[lines.length - 1]
Expand Down
12 changes: 11 additions & 1 deletion test/next-fixture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@ const runCommand = (
options: { cwd?: string; env?: NodeJS.ProcessEnv } = {},
) =>
new Promise<void>((resolve, reject) => {
const env: NodeJS.ProcessEnv = { ...process.env, ...options.env }

// Drop undefined env entries to avoid Windows EINVAL from spawn.
for (const key of Object.keys(env)) {
if (env[key] === undefined) {
delete env[key]
}
}

const child = spawn(bin, args, {
cwd: options.cwd,
env: options.env,
env,
stdio: ['ignore', 'pipe', 'pipe'],
shell: process.platform === 'win32',
})

let stderr = ''
Expand Down