test(spec): type-check the spec api as part of make test

The fake runtime in api.test.ts did not return a chainable handle from extract,
so the file had not type-checked since named() was added. Wiring the check into
make test stops it drifting again.

Claude-Session: https://claude.ai/code/session_01Fj4wJUikdABuMQEETwW55J
This commit is contained in:
pj committed 2026-08-12 16:49:02 +05:30
1 parent d25b56379a
commit 12eb1439e9
2 files changed
+11 -3

No files matched your search

+5 -2
View File
@@ -29,7 +29,7 @@ WEB_DIST := replay-ui/dist
GOLINES := $(shell $(GO) env GOPATH)/bin/golines GOLINES := $(shell $(GO) env GOPATH)/bin/golines
.PHONY: bootstrap proto sidecar sanderling install test test-go test-browser test-companion test-kotlin test-spec-api web-test web-typecheck web-build web-dev replay-dev docs clean release-cli release-npm-dry fmt fmt-go fmt-kotlin fmt-ts fmt-swift .PHONY: bootstrap proto sidecar sanderling install test test-go test-browser test-companion test-kotlin test-spec-api spec-typecheck web-test web-typecheck web-build web-dev replay-dev docs clean release-cli release-npm-dry fmt fmt-go fmt-kotlin fmt-ts fmt-swift
bootstrap: bootstrap:
$(GO) mod download $(GO) mod download
@@ -101,7 +101,7 @@ fmt-ts:
fmt-swift: fmt-swift:
xcrun swift-format format -i -r companion/Sources xcrun swift-format format -i -r companion/Sources
test: test-go test-spec-api web-typecheck web-test test: test-go spec-typecheck test-spec-api web-typecheck web-test
test-go: test-go:
$(GO) test $(GO_PACKAGES) $(GO) test $(GO_PACKAGES)
@@ -126,6 +126,9 @@ test-kotlin:
test-spec-api: test-spec-api:
cd pkg/spec && npm test --silent cd pkg/spec && npm test --silent
spec-typecheck:
cd pkg/spec && npm run check --silent
docs: $(DOCS_OUT) build/site/_assets docs: $(DOCS_OUT) build/site/_assets
@echo "built $(words $(DOCS_OUT)) pages to build/site" @echo "built $(words $(DOCS_OUT)) pages to build/site"
+6 -1
View File
@@ -112,7 +112,12 @@ function installFakeRuntime(): RecordedRuntime {
extract: <T>(getter: (state: State) => T, name?: string): Extracted<T> => { extract: <T>(getter: (state: State) => T, name?: string): Extracted<T> => {
calls.extracts.push(getter as (state: State) => unknown); calls.extracts.push(getter as (state: State) => unknown);
calls.extractNames.push(name); calls.extractNames.push(name);
return { current: undefined as unknown as T, previous: undefined }; const handle: Extracted<T> = {
current: undefined as unknown as T,
previous: undefined,
named: () => handle,
};
return handle;
}, },
always: (predicateOrFormula: (() => boolean) | Formula): Formula => { always: (predicateOrFormula: (() => boolean) | Formula): Formula => {
calls.alwaysArgs.push(predicateOrFormula); calls.alwaysArgs.push(predicateOrFormula);