Following the PLAYBOOK.md TDD workflow:
Created E2E tests in tests/cli.test.ts for funee standard library functionality:
Test Suite: "funee standard library"
- ✅
imports Closure type from "funee"- Test type imports work - ✅
uses Closure constructor at runtime- Test runtime Closure() function - ✅
imports log from "funee"- Test host function imports - ✅
imports multiple exports from "funee"- Test combined imports - ✅
Closure constructor accepts plain object references- Test object → Map conversion - ✅
Closure constructor accepts Map references- Test direct Map usage - ✅
imports createMacro from "funee"- Test createMacro import - ✅
createMacro throws at runtime if not expanded- Test safety check
Fixtures Created:
tests/fixtures/funee-lib/import-types.tstests/fixtures/funee-lib/closure-constructor.tstests/fixtures/funee-lib/import-log.tstests/fixtures/funee-lib/multiple-imports.tstests/fixtures/funee-lib/closure-plain-refs.tstests/fixtures/funee-lib/closure-map-refs.tstests/fixtures/funee-lib/import-create-macro.tstests/fixtures/funee-lib/createMacro-throws.ts
Cannot run tests yet due to:
- WIP macro implementation files causing compilation errors
- Moved to
.wip/directory temporarily:capture_closure.rsdetect_macro_calls.rsmacro_runtime.rs(multiple versions)macro_helpers.jsprocess_macros_integration.rs
- Commented out mod declarations in
src/execution_request.rs - Commented out uses in
src/execution_request/source_graph.rs
Note: Need clean Rust build before running tests.
Once tests can run and fail, implement:
-
Resolve "funee" imports
- Update
load_module_declaration.rsto recognize "funee" as virtual module - Point to
funee-lib/index.tsfor type resolution
- Update
-
Bundle funee-lib code
- Include
funee-lib/core.tsexports in bundled output Closureconstructor functioncreateMacrofunction (throws at runtime)CanonicalNametype (TypeScript only, not runtime)
- Include
-
Link host functions
log→op_log(already implemented)debug→op_debug(needs implementation)
-
Test-driven fixes
- Run tests
- Fix failures one by one
- Commit when each test passes
-
Clean build environment
cargo clean cargo build --release
-
Run tests to verify they fail
cd tests && npm test -- --run
-
Implement bundler support
- Start with simplest test:
import-log.ts - Make it pass
- Move to next test
- Start with simplest test:
-
Iterate until all tests pass
- Commit after each passing test
- Document any design changes
From PLAYBOOK.md:
Write the test FIRST (in tests/cli.test.ts) Test should fail initially Implement the feature Test should pass Commit with both test and implementation
Benefits:
- ✅ Clear acceptance criteria (tests define success)
- ✅ Prevents over-engineering (only implement what tests need)
- ✅ Regression protection (tests verify nothing breaks)
- ✅ Documentation (tests show how to use the feature)
The funee standard library provides:
- Core types (
Closure,CanonicalName) for macro system - Runtime functions (
Closure()constructor) for bundler-generated code - Host functions (
log,debug) implemented in Rust - Compile-time markers (
createMacro) for macro definitions
See funee-lib/FUNEE_LIB_DESIGN.md for full architecture.