diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 00000000..cdcdccdf --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,38 @@ +name: '๐ŸชŸ' +on: + push: + branches: + - 'main' + pull_request: + workflow_dispatch: + +jobs: + node: + runs-on: windows-latest + timeout-minutes: 5 + strategy: + fail-fast: false + name: Windows + steps: + - name: โž• Actions - Checkout + uses: actions/checkout@v4 + + - name: โž• Actions - Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: โž• Actions - Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: '20.x' + + - name: ๐Ÿ“ฆ Installing Dependencies + run: npm ci + + - name: ๐Ÿคน๐Ÿปโ€โ™€๏ธ Building the Project + run: npm run build + + - name: ๐Ÿ”ฌ Node + run: npm run test diff --git a/package.json b/package.json index cf19b0ee..8fcc7a17 100644 --- a/package.json +++ b/package.json @@ -4,26 +4,26 @@ "description": "๐Ÿท Poku makes testing easy for Node.js, Bun & Deno at the same time.", "main": "./lib/index.js", "scripts": { - "test": "npx tsx --tsconfig ./tsconfig.test.json ./test/run.test.ts", + "test": "tsx --tsconfig ./tsconfig.test.json ./test/run.test.ts", "pretest:c8": "npm run build", "test:c8": "docker compose -f test/docker/docker-compose.c8.yml up", - "test:ci:c8": "npx c8 --include 'src/**' --exclude 'src/@types/**' --reporter=text --reporter=lcov npx tsx test/run.test.ts", + "test:ci:c8": "c8 --include 'src/**' --exclude 'src/@types/**' --reporter=text --reporter=lcov tsx test/run.test.ts", "test:ci": "tsx ./test/ci.test.ts", "test:node": "FILTER='node-' npm run test:ci", "test:deno": "FILTER='deno-' npm run test:ci", "test:bun": "FILTER='bun-' npm run test:ci", - "prebuild": "rm -rf ./lib ./ci", "predocker:deno": "docker compose -f ./test/docker/playground/deno/docker-compose.yml down", "docker:deno": "docker compose -f ./test/docker/playground/deno/docker-compose.yml up --build", - "build": "npx tsc; npx tsc -p tsconfig.test.json", - "postbuild": "npx tsx ./tools/compatibility/node.ts; chmod +x lib/bin/index.js; npm audit", - "eslint:checker": "npx eslint . --ext .js,.ts", - "eslint:fix": "npx eslint . --fix --config ./.eslintrc.json", - "lint:checker": "npm run eslint:checker; npm run prettier:checker", - "lint:fix": "npm run eslint:fix; npm run prettier:fix", - "prettier:checker": "npx prettier --check .", - "prettier:fix": "npx prettier --write .github/workflows/*.yml .", - "update": "npx npu; npm i; npm run lint:fix; npm audit" + "prebuild": "rm -rf ./lib ./ci", + "build": "tsc && tsc -p tsconfig.test.json", + "postbuild": "tsx ./tools/compatibility/node.ts && chmod +x lib/bin/index.js && npm audit", + "eslint:checker": "eslint . --ext .js,.ts", + "eslint:fix": "eslint . --fix --config ./.eslintrc.json", + "lint:checker": "npm run eslint:checker && npm run prettier:checker", + "lint:fix": "npm run eslint:fix && npm run prettier:fix", + "prettier:checker": "prettier --check .", + "prettier:fix": "prettier --write .github/workflows/*.yml .", + "update": "npu && npm i && npm run lint:fix && npm audit" }, "license": "MIT", "repository": { diff --git a/src/modules/list-files.ts b/src/modules/list-files.ts index 8b6b4471..6b8864fc 100644 --- a/src/modules/list-files.ts +++ b/src/modules/list-files.ts @@ -7,7 +7,7 @@ export const sanitizePath = (input: string, ensureTarget?: boolean): string => { const sanitizedPath = input .replace(/[/\\]+/g, path.sep) // adapting slashes according to OS .replace(/(\.\.(\/|\\|$))+/g, '') // ensure the current path level - .replace(/[<>:|^?*]+/g, ''); // removing unusual path characters + .replace(/[<>|^?*]+/g, ''); // removing unusual path characters // Preventing absolute path access return ensureTarget ? sanitizedPath.replace(/^[/\\]/, './') : sanitizedPath; diff --git a/src/services/run-test-file.ts b/src/services/run-test-file.ts index b13af720..4976aff6 100644 --- a/src/services/run-test-file.ts +++ b/src/services/run-test-file.ts @@ -26,10 +26,16 @@ export const runTestFile = ( ): Promise => new Promise(async (resolve) => { const runtimeOptions = runner(filePath, configs); - const runtime = runtimeOptions.shift(); - const runtimeArguments = + const originalRuntime = runtimeOptions.shift(); + let runtime = originalRuntime; + let runtimeArguments = runtimeOptions.length > 1 ? [...runtimeOptions, filePath] : [filePath]; + if (process.platform === 'win32' && originalRuntime === 'tsx') { + runtime = 'npx.cmd'; + runtimeArguments = ['tsx', ...runtimeArguments]; + } + const fileRelative = path.relative(process.cwd(), filePath); const showLogs = !isQuiet(configs); const showSuccess = isDebug(configs); diff --git a/test/integration/cli.test.ts b/test/integration/cli.test.ts index c782b9ae..e3f3a0c6 100644 --- a/test/integration/cli.test.ts +++ b/test/integration/cli.test.ts @@ -6,14 +6,20 @@ import { runner } from '../../src/helpers/runner.js'; // `/_.ts`: Simulate TypeScript file for Deno const currentFile = typeof __filename === 'string' ? __filename : '/_.ts'; const runtimeOptions = runner(currentFile); -const runtime = runtimeOptions.shift()!; +const originalRuntime = runtimeOptions.shift(); +let runtime = originalRuntime!; const ext = runtime === 'node' ? 'js' : 'ts'; const executeCLI = (args: string[]): Promise => new Promise((resolve, reject) => { - const runtimeArguments = + let runtimeArguments = runtimeOptions.length > 1 ? [...runtimeOptions, ...args] : [...args]; + if (process.platform === 'win32' && originalRuntime === 'tsx') { + runtime = 'npx.cmd'; + runtimeArguments = ['tsx', ...runtimeArguments]; + } + const childProcess = spawn(runtime, runtimeArguments, { shell: false, cwd: process.cwd(), diff --git a/website/src/css/custom.scss b/website/src/css/custom.scss index c9bebacd..e9968f7e 100644 --- a/website/src/css/custom.scss +++ b/website/src/css/custom.scss @@ -126,6 +126,10 @@ pre[class*='language-'] { no-repeat; } +html[data-theme='light'] { + background-color: #eff2f9; +} + html[data-theme='dark'] { background-color: #161927; color: #b9bfdc;