You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enforces Test coverage & Improves Reliability (#16)
# TLDR
The Osprey compiler now has enforced test coverage in CI. A failure will
occur if coverage drops below a stored threshold, or the stored
threshold will be updated if coverage improves.
# What Was Added?
- Test coverage enforcement, including the ability to bootstrap the
initial coverage threshold.
- Improved test setup and teardown, moving the `cleanAndRebuildAll`
functionality into a shared utility for consistent test environments.
- Clearer output for successful program executions in CLI tests.
# What Was Changed / Deleted?
- The CI pipeline now uses `gh variable` to store and update coverage
thresholds, rather than relying on environment variables.
- The test suite now reports coverage and enforces a minimum coverage
percentage, failing the build if the coverage drops.
- Streamlined the coverage report generation and display.
- Removed `ensure-built` target from Makefile and `build-no-lint`,
favoring a single `build` target for simplicity.
- The cleaning and rebuilding logic in tests has been consolidated into
`testutil.CleanAndRebuildAll`.
# How Do The Automated Tests Prove It Works?
The automated tests now fail if the code coverage decreases below the
set threshold, ensuring that new code includes tests. The existing
integration and codegen tests confirm the functional correctness of the
compiler, and those tests are run as part of the coverage enforcement in
CI.
# Summarise Changes To The Spec Here
There are no specification changes associated with this pull request.
go test -v ./tests/integration/ -run "TestRootLevelExamples|TestLanguageFeatures|TestBasicCompilation|TestErrorHandling|TestFunctionArguments|TestCompilationFailures"
138
-
139
-
# Run HTTP integration tests
140
-
test-http: fiber-runtime http-runtime
141
-
@echo "🌐 Running HTTP integration tests..."
142
-
go test -v ./tests/integration/ -run "TestHttpExamples"
143
-
144
-
# Run WebSocket integration tests
145
-
test-websocket: fiber-runtime http-runtime
146
-
@echo "🔌 Running WebSocket integration tests..."
147
-
go test -v ./tests/integration/ -run "TestWebsoxExamples"
148
-
149
-
# Run Fiber integration tests
150
-
test-fiber: fiber-runtime http-runtime
151
-
@echo "🧵 Running Fiber integration tests..."
152
-
go test -v ./tests/integration/ -run "TestFiberExamples|TestFiberFeatures|TestFiberErrorHandling|TestFiberModuleIsolation|TestFiberIntegration"
153
-
154
-
# Run CLI integration tests
155
-
test-cli: ensure-built
156
-
@echo "⌨️ Running CLI integration tests..."
157
-
go test -v ./tests/integration/ -run "TestCLI"
158
-
159
-
# Run tests with coverage
160
-
test-coverage:
161
-
@echo "📊 Running tests with coverage..."
162
-
mkdir -p outputs
163
-
go test -coverprofile=outputs/coverage.out ./internal/... ./tests/integration/
164
-
@if [ -f outputs/coverage.out ];then\
165
-
go tool cover -html=outputs/coverage.out -o outputs/coverage.html;\
echo"⚠️ No coverage data generated (packages may have no statements)";\
169
-
touch outputs/coverage.html;\
170
-
echo"<html><body><h1>No Coverage Data</h1><p>No coverage data was generated. This may happen when packages have no statements to cover.</p></body></html>"> outputs/coverage.html;\
171
-
fi
172
-
173
-
# Test Rust interop functionality
174
-
test-rust-interop: ensure-built
175
-
@echo "🦀 Testing Rust interop functionality..."
176
-
@if !command -v rustc >/dev/null 2>&1;then\
177
-
echo"❌ RUST COMPILER NOT FOUND! Install Rust: https://rustup.rs/";\
178
-
exit 1;\
179
-
fi
180
-
@if !command -v cargo >/dev/null 2>&1;then\
181
-
echo"❌ CARGO NOT FOUND! Install Rust toolchain: https://rustup.rs/";\
0 commit comments