Repository navigation
test: Add Playwright browser config to Vitest; Add GitHub test workflow. #125
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
Changes from 4 commits
e6b30e5
db8bebd
aa3c043
41a6a8e
d56f135
7ae1f57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: "tests" | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: &monitored_paths | ||
| - ".github/workflows/tests.yaml" | ||
| - "CMakeLists.txt" | ||
| - "package-lock.json" | ||
| - "package.json" | ||
| - "src/**" | ||
| - "taskfile.yaml" | ||
| - "taskfiles/**" | ||
| - "test/**" | ||
| - "tsconfig.json" | ||
| - "vitest*config.ts" | ||
|
Bill-hbrhbr marked this conversation as resolved.
Resolved
|
||
| 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" | ||
|
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Pin the Node.js version with The workflow does not pin Node.js — it relies on whatever version is pre-installed on ♻️ 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 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,5 +16,6 @@ dist | |
| .idea | ||
| .vscode | ||
|
|
||
| # Test data | ||
| # Tests | ||
| /test/data | ||
| /test/__screenshots__ | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const setup = async () => { | ||
| // no-op | ||
| }; | ||
|
|
||
| export default setup; |
| 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, | ||
| }, | ||
| }, | ||
| ], | ||
|
Bill-hbrhbr marked this conversation as resolved.
Resolved
|
||
| }, | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.