Use Go's standard test runner.
- Unit tests cover domain logic and pure transformations.
- Integration tests cover persistence, API boundaries, queues, and external service adapters.
- End-to-end tests cover critical user workflows once a UI or API surface exists.
- Regression tests accompany meaningful bug fixes.
scripts/test-go-modules.sh
scripts/check-root-deps.sh
go test ./...
scripts/vulncheck-go-modules.sh
go build ./cmd/gowdk
node --check editors/vscode/extension.js
node --test editors/vscode/*.test.js
scripts/test-parser-fuzz.sh
scripts/test-generated-app-integration.sh
scripts/test-generated-output-determinism.sh
scripts/test-runtime-race.sh
go build -o /tmp/gowdk-cli ./cmd/gowdk
rm -rf /tmp/gowdk-init && /tmp/gowdk-cli init /tmp/gowdk-init && (cd /tmp/gowdk-init && /tmp/gowdk-cli build)
rm -rf /tmp/gowdk-init-tested && /tmp/gowdk-cli init --tests /tmp/gowdk-init-tested && (cd /tmp/gowdk-init-tested && /tmp/gowdk-cli test --count=1 --timeout=2m)
go run ./cmd/gowdk build --out /tmp/gowdk-build examples/pages/home.page.gwdk examples/pages/hero.cmp.gwdk
test -f /tmp/gowdk-build/gowdk-routes.json
test -f /tmp/gowdk-build/gowdk-assets.json
test -f /tmp/gowdk-build/openapi.json
test -f /tmp/gowdk-build/asyncapi.json
go test ./cmd/gowdkUse node --check and node --test editors/vscode/*.test.js when editor extension files change or before release-style verification.
Example commands run from the repository root use the root gowdk.config.go.
Project-level compiler commands must have that file in the working directory or
must pass --config <file>.
| Area | Command | When |
|---|---|---|
| Go packages | scripts/test-go-modules.sh |
Every code change; includes the root module and nested optional adapter modules. |
| Root dependency surface | scripts/check-root-deps.sh |
Dependency-policy changes, CI, and release-style verification. |
| Root Go packages | go test ./... |
Core compiler/runtime changes when optional adapter modules are not relevant. |
| Go vulnerability scan | scripts/vulncheck-go-modules.sh |
Release-style checks and dependency changes. |
| CLI build | go build ./cmd/gowdk |
CLI, compiler, runtime, addon, or release changes. |
| Go formatting | gofmt -w <files> |
Changed Go files before handoff. |
| Parser fuzz smoke | scripts/test-parser-fuzz.sh |
Parser, tokenizer, syntax recovery, and diagnostic recovery changes. |
| Generated app integration | scripts/test-generated-app-integration.sh |
Generated binary, SSR, action, fragment, CSRF, and contract adapter changes. |
| Generated output determinism | scripts/test-generated-output-determinism.sh |
Generated HTML, manifest, report, inspect, or route/sitemap output changes. |
| Incremental build equivalence | go test ./internal/buildgen -run TestIncrementalBuildMatchesCleanBuildEquivalence -count=1 |
Incremental SPA output, stale generated asset cleanup, route cleanup, or build report comparison changes. |
| Runtime race detector | scripts/test-runtime-race.sh |
Shared-state runtime packages, lifecycle, contracts, SSE, rate limiting, trace, or testkit changes. |
| VS Code extension syntax | node --check editors/vscode/extension.js |
Editor extension changes and broad verification. |
| VS Code extension behavior | node --test editors/vscode/*.test.js |
Editor extension pure helper changes and broad verification. |
| SPA and action endpoint examples | go run ./cmd/gowdk check examples/pages/home.page.gwdk examples/actions/newsletter.page.gwdk |
Language/tooling changes. |
| Init project smoke | go build -o /tmp/gowdk-cli ./cmd/gowdk && rm -rf /tmp/gowdk-init && /tmp/gowdk-cli init /tmp/gowdk-init && (cd /tmp/gowdk-init && /tmp/gowdk-cli build) |
CLI scaffold changes. |
| Init project tests | go build -o /tmp/gowdk-cli ./cmd/gowdk && rm -rf /tmp/gowdk-init-tested && /tmp/gowdk-cli init --tests /tmp/gowdk-init-tested && (cd /tmp/gowdk-init-tested && /tmp/gowdk-cli test --count=1 --timeout=2m) |
CLI scaffold or gowdk test changes. |
| SSR example | go run ./cmd/gowdk check --ssr examples/ssr/dashboard.page.gwdk |
SSR validation or example changes. |
| Manifest smoke | go run ./cmd/gowdk manifest --ssr examples/pages/*.gwdk examples/actions/*.gwdk examples/partials/*.gwdk examples/api/*.gwdk examples/ssr/*.gwdk |
Manifest, parser, or CLI output changes. |
| SPA build smoke | go run ./cmd/gowdk build --out /tmp/gowdk-build examples/pages/home.page.gwdk examples/pages/hero.cmp.gwdk && test -f /tmp/gowdk-build/gowdk-routes.json && test -f /tmp/gowdk-build/gowdk-assets.json && test -f /tmp/gowdk-build/openapi.json && test -f /tmp/gowdk-build/asyncapi.json |
Parser, view, buildgen, component, or CLI build changes. |
| Dev loop tests | go test ./cmd/gowdk |
Dev mode changes. |
| Action redirect smoke | go run ./cmd/gowdk build --out /tmp/gowdk-action-build --app /tmp/gowdk-action-app --bin /tmp/gowdk-action-site examples/actions/signup.page.gwdk |
Action parsing or generated action endpoint changes. |
| Local serve tests | go test ./cmd/gowdk |
CLI serving or option parsing changes. |
| Generated app tests | go test ./cmd/gowdk ./internal/appgen |
Generated embedded app or binary-serving changes. |
scripts/test-parser-fuzz.shis the explicit parser fuzz runner. It defaults toGOWDK_FUZZTIME=1000xfor deterministic CI smoke cost; use a larger count or a longer local run such asGOWDK_FUZZTIME=100000x scripts/test-parser-fuzz.shorGOWDK_FUZZTIME=30s scripts/test-parser-fuzz.shbefore risky parser work.scripts/test-generated-app-integration.shis the generated-app integration slice. It builds temporary binaries throughinternal/appgentests and exercises representative request-time flows.scripts/test-generated-output-determinism.shis the generated output and report determinism slice. It compares two clean builds plus manifest, sitemap, routes, and asset-graph report output.TestIncrementalBuildMatchesCleanBuildEquivalencecompares an incremental output tree with a clean build of the same final state. It includes served output, sibling compiler reports, manifests, file bytes, and file modes; the only normalization is the documentedgowdk-build-report.jsonprojection for progress-path events that intentionally differ between clean and incremental runs.scripts/test-runtime-race.shis the focused race-detector slice. It runs an explicit package list undergo test -race -count=1and fails preflight when a selected package has no tests.
Keep these as separate commands so CI can show whether a failure is fuzz input, runtime integration, race detection, or nondeterministic output.
- Core domain behavior.
- Compiler diagnostics for render modes and addon requirements.
- Manifest generation and route normalization.
- Parser behavior for
.gwdksyntax. - SPA/prerender output and generated route handlers.
- Typed action decoding, validation, CSRF, redirects, and fragments.
- SSR addon routing, guards,
server {}, layouts, and errors.
internal/compilertests cover SSR addon enforcement, duplicate page/component/layout identities, layout reference resolution, dynamic SPA routes requiringpaths, actions without SSR, andserver {}rejection on SPA pages.internal/discovertests cover recursive.gwdkinclude/exclude matching.internal/parsertests cover page/component/layout metadata declarations,paths,build,server,view,props,act, capturedpaths/build/server/viewbodies, the first action input/redirect body subset, and render mode rejection.internal/viewrendertests cover view markup rendering, escaping, expression attributes, shorthand class/id normalization, component expansion, and missing component/prop errors.internal/buildgentests cover app-shell HTML emission, literal build data, imported Go build data functions, build-data route-param binding, literal dynamic paths, route and asset manifest output, component expansion, nested route output paths, and no partial output on unsupported pages.internal/langtests cover lexical tokenization, diagnostics, formatting, file checks, and manifest JSON from parsed source files.internal/langtests cover site-map JSON for movable page files.internal/langgolden tests cover the IR-derived manifest JSON render/path/guard/action output.internal/compilertests cover route metadata for SPA/SSR routes, endpoint metadata for actions/APIs, and missing SSR addon rejection.internal/clientrttests cover the embedded framework browser runtime source files, render the placeholder templates, require Node for the client expression conformance test againstinternal/clientlang, runnode --checkfor those.jsfiles whennodeis available, and run a dependency-free Node DOM harness for innerHTML and outerHTML swaps.internal/lsptests cover initialize, diagnostics, formatting, completion, hover, component and open-Go go-to-definition, references, semantic tokens, code actions, shutdown, and exit protocol behavior.editors/vscodetests cover extension route hierarchy helpers.cmd/gowdktests coverbuild --outwritingindex.html, expanding a component file, discovering build inputs when explicit paths are omitted, loading literal build config for source/output settings, configured build targets, selected target builds, and local generated-output serving behavior.cmd/gowdktests cover dev option parsing, invalid dev intervals, content-hash input snapshots, snapshot diffs, no-op touch detection, incremental SPA page rebuild selection, and component-change fallback.cmd/gowdkandinternal/appgentests cover generated embedded app source, binary compilation, WASM artifact compilation, live binary HTTP serving, and first-slice action redirect routing.cmd/gowdktests covergowdk testbuilding temporary generated artifacts, starting the generated binary on an ephemeral address, and running scaffolded generated app tests through ordinarygo test.runtime/testkittests cover scenario helpers, cookie-preserving direct andhttptest.Serverclients, JSON/form request helpers, response assertions, and redacted failure summaries.- Update the generated app golden with
go test ./internal/appgen -run TestGeneratedGoMatchesGoldenFixture -updatewhen an intentional generated Go change lands. internal/buildgenandinternal/appgentests cover preserving unchanged generated file modification times so local dev loops do not retrigger on identical output.internal/buildgentests cover incremental changed-page rendering, complete route manifest refreshes, stale route output cleanup, stale generated asset cleanup, and clean-versus-incremental output equivalence for the current SPA slice.internal/projecttests cover literalgowdk.config.goparsing for source discovery, module source groups, build output, and build targets.- Nested optional adapter modules cover Chi, Echo, Fiber, Gin, Redis Streams, NATS, and WebSocket integration packages without adding those third-party dependencies to the root module graph.
internal/parser/fuzz_test.godefinesFuzzParseSyntaxwith page, component, layout, endpoint, and broken-source seeds.scripts/test-generated-output-determinism.shcompares generated HTML, route/asset manifests, OpenAPI/AsyncAPI, build reports, and public report command output across two clean runs.