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
51 changes: 51 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "tests"

on:
pull_request:
paths: &monitored_paths
- ".github/workflows/test.yaml"
- "CMakeLists.txt"
- "package-lock.json"
- "package.json"
- "src/**"
- "taskfile.yaml"
- "taskfiles/**"
- "test/**"
- "tsconfig.json"
- "vitest.config.ts"
push:
paths: *monitored_paths
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:

permissions: {}

concurrency:
group: "${{github.workflow}}-${{github.ref}}"

# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
tests:
runs-on: "ubuntu-24.04"
steps:
- uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1
with:
submodules: "recursive"
Comment thread
Bill-hbrhbr marked this conversation as resolved.
Resolved

- name: "Install task"
run: "npm install -g @go-task/cli@3.48.0"

- name: "Log tool versions"
run: |-
cmake --version
md5sum --version
node --version
npm --version
task --version

- name: "Run JS tests"
run: "task test:js"
Comment on lines +32 to +51

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Pin the Node.js version with actions/setup-node.

The workflow does not pin Node.js — it relies on whatever version is pre-installed on ubuntu-24.04. Runner image updates can silently change the Node.js version, making failures hard to diagnose. Adding actions/setup-node makes the environment fully reproducible and consistent with how other tools (@go-task/cli) are explicitly versioned.

♻️ Proposed fix
      - uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8"  # v6.0.1
        with:
          submodules: "recursive"

+     - uses: "actions/setup-node@<pinned-sha>"  # vX.Y.Z
+       with:
+         node-version: "<version-used-in-project>"

      - name: "Install task"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test.yaml around lines 32 - 51, Add a pinned Node.js setup
step to the tests job using actions/setup-node before running tools or tests:
insert a step that uses "actions/setup-node@v4" (or latest stable) with the
node-version input set to the desired semver (e.g., "18.x" or a specific patch)
so the environment is deterministic; place this new step before the "Log tool
versions" and "Run JS tests" steps to ensure node/npm are the expected versions
when task test:js and `@go-task/cli` run.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ dist
.idea
.vscode

# Test data
# Tests
/test/data
/test/__screenshots__
185 changes: 185 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"lint:check:js": "tsc --noEmit && eslint . --max-warnings 0",
"lint:fix:js": "npm run lint:check:js -- --fix",
"release": "git diff --exit-code && task package && npm publish",
"test": "vitest run"
"test:init": "PLAYWRIGHT_BROWSERS_PATH=0 npm exec playwright -- install --with-deps",
"test": "PLAYWRIGHT_BROWSERS_PATH=0 vitest run"
Comment thread
Bill-hbrhbr marked this conversation as resolved.
Resolved
},
"type": "module",
"files": [
Expand All @@ -39,6 +40,7 @@
},
"devDependencies": {
"@types/node": "^22.19.9",
"@vitest/browser-playwright": "^4.0.18",
"eslint": "^9.39.2",
"eslint-config-yscope": "^1.1.2",
"typescript": "^5.9.3",
Expand Down
6 changes: 5 additions & 1 deletion taskfiles/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ tasks:
default:
deps: ["js"]

js:
init:
deps: [":package", ":node-modules"]
cmd: "npm run test:init"
Comment thread
Bill-hbrhbr marked this conversation as resolved.
Resolved

js:
deps: ["init"]
cmd: "npm run test {{.CLI_ARGS}}"
Comment thread
Bill-hbrhbr marked this conversation as resolved.
Resolved
11 changes: 11 additions & 0 deletions test/ClpStreamReader.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
describe,
expect,
it,
} from "vitest";

describe("ClpStreamReader", () => {
it("dummy test", () => {
expect(true).toBe(true);
});
});
5 changes: 5 additions & 0 deletions test/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const setup = async () => {
// no-op
};

export default setup;
32 changes: 29 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
import {defineConfig} from "vitest/config";
import {playwright} from "@vitest/browser-playwright";


export default defineConfig({
test: {
include: ["test/**/*.test.ts"],
environment: "node",
testTimeout: 30_000,
globalSetup: "test/globalSetup.ts",
projects: [
{
test: {
name: "node",
include: ["test/**/*.test.ts"],
environment: "node",
testTimeout: 30_000,
},
},
{
test: {
name: "browser",
include: ["test/**/*.test.ts"],
browser: {
enabled: true,
provider: playwright(),
instances: [
{browser: "chromium"},
{browser: "firefox"},
{browser: "webkit"},
],
headless: true,
},
testTimeout: 30_000,
},
},
],
Comment thread
Bill-hbrhbr marked this conversation as resolved.
Resolved
},
});