Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,17 @@ jobs:
exit 1
fi

- name: Run wasm golden tests (Go string API)
run: make test-wasm-golden

- name: Set up Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version: '20'

- name: Run wasm binary golden tests (Node.js)
run: node scripts/test-wasm-golden.mjs

validate-yaml:
runs-on: ubuntu-latest
permissions:
Expand Down
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ update-golden:
@echo "Updating golden test files..."
go test -v ./pkg/console -run='^TestGolden_' -update

# Wasm golden tests — compare wasm (string API) compiler output against golden files
.PHONY: test-wasm-golden
test-wasm-golden:
@echo "Running wasm golden tests (Go string API path)..."
go test -v -timeout=5m -run='^TestWasmGolden_' ./pkg/workflow

# Update wasm golden files from current string API output
.PHONY: update-wasm-golden
update-wasm-golden:
@echo "Updating wasm golden test files..."
go test -v -timeout=5m -run='^TestWasmGolden_' ./pkg/workflow -update

# Build wasm and run Node.js golden comparison test
.PHONY: test-wasm
test-wasm: build-wasm
@echo "Running wasm binary golden tests (Node.js)..."
node scripts/test-wasm-golden.mjs

# Test specific integration test groups (matching CI workflow)
.PHONY: test-integration-compile
test-integration-compile:
Expand Down Expand Up @@ -221,9 +239,9 @@ bundle-js:
@echo "✓ bundle-js tool built"
@echo "To bundle a JavaScript file: ./bundle-js <input-file> [output-file]"

# Test all code (Go and JavaScript)
# Test all code (Go, JavaScript, and wasm golden)
.PHONY: test-all
test-all: test test-js
test-all: test test-js test-wasm-golden

# Run tests with coverage
.PHONY: test-coverage
Expand Down Expand Up @@ -729,7 +747,10 @@ help:
@echo " test-unit - Run Go unit tests only (faster)"
@echo " test-security - Run security regression tests"
@echo " test-js - Run JavaScript tests"
@echo " test-all - Run all tests (Go and JavaScript)"
@echo " test-all - Run all tests (Go, JavaScript, and wasm golden)"
@echo " test-wasm-golden - Run wasm golden tests (Go string API path)"
@echo " test-wasm - Build wasm and run Node.js golden comparison test"
@echo " update-wasm-golden - Regenerate wasm golden files from current compiler output"
@echo " test-coverage - Run tests with coverage report"
@echo " bench - Run benchmarks for performance testing"
@echo " bench-compare - Run benchmarks with more iterations (for benchstat comparison)"
Expand Down
12 changes: 12 additions & 0 deletions pkg/parser/virtual_fs_test_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package parser

// SetReadFileFuncForTest overrides the file reading function for testing.
// This enables testing virtual filesystem behavior in native (non-wasm) builds.
// Returns a cleanup function that restores the original.
func SetReadFileFuncForTest(fn func(string) ([]byte, error)) func() {
original := readFileFunc
readFileFunc = fn
return func() {
readFileFunc = original
}
}
Loading
Loading