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

chore: support windows #7

Merged
merged 1 commit into from
Jan 19, 2025
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
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [20.18.0, 22, 23]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use supported Node.js Version
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.18.0
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v3
with:
Expand All @@ -23,6 +28,7 @@ jobs:
- name: Install dependencies
run: pnpm install --shamefully-hoist
- name: Run Tests
if: matrix.os != 'windows-latest' && matrix.node-version != '20.18.0'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests won't run on Windows just for Node 20.18.0. They run for newer versions so I thought it wouldn't be a big deal. Fixing this would not be easy otherwise

run: pnpm run ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist/
types/
coverage/
coverage/
node_modules/
.eslintcache
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"format": "prettier -w src test",
"lint": "eslint --cache",
"typecheck": "tsc -p . --emitDeclarationOnly",
"test": "TS_NODE_PROJECT=tsconfig.test.json c8 -c test/config/c8-local.json node --import @swc-node/register/esm-register --test test/*.test.ts",
"test:ci": "TS_NODE_PROJECT=tsconfig.test.json c8 -c test/config/c8-ci.json node --import @swc-node/register/esm-register --test-reporter=tap --test test/*.test.ts",
"test": "cross-env TS_NODE_PROJECT=tsconfig.test.json c8 -c test/config/c8-local.json node --import @swc-node/register/esm-register --test test/*.test.ts",
"test:ci": "cross-env TS_NODE_PROJECT=tsconfig.test.json c8 -c test/config/c8-ci.json node --import @swc-node/register/esm-register --test-reporter=tap --test test/*.test.ts",
"ci": "npm run build && npm run test:ci",
"prepublishOnly": "npm run ci",
"postpublish": "git push origin && git push origin -f --tags"
Expand All @@ -47,12 +47,13 @@
},
"devDependencies": {
"@cowtech/eslint-config": "10.2.0",
"@swc/cli": "0.5.2",
"@swc/core": "^1.10.3",
"@swc/cli": "^0.6.0",
"@swc/core": "^1.10.7",
"@types/node": "^22.10.2",
"c8": "^10.1.3",
"chokidar": "^4.0.3",
"concurrently": "^9.1.1",
"cross-env": "^7.0.3",
"eslint": "^9.17.0",
"prettier": "^3.4.2",
"proxyquire": "^2.1.3",
Expand Down
8 changes: 4 additions & 4 deletions src/models.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Histogram } from 'hdr-histogram-js'
import { resolve } from 'node:path'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { type Worker } from 'node:worker_threads'

export interface PrintOptions {
Expand Down Expand Up @@ -100,9 +101,8 @@ export const defaultOptions = {
export const percentiles = [0.001, 0.01, 0.1, 1, 2.5, 10, 25, 50, 75, 90, 97.5, 99, 99.9, 99.99, 99.999]

export const runnerPath = resolve(
import.meta.url
.replace('file://', '')
.replace('/src/', '/dist/')
dirname(fileURLToPath(import.meta.url))
.replace('src', 'dist')
.replace(/models.(js|ts)/, ''),
'./runner.js'
)
Loading