Skip to content

fix(cli): resolve test imports from the project root - #2945

Open
slepp wants to merge 1 commit into
mainfrom
fix/hew-test-project-root
Open

fix(cli): resolve test imports from the project root#2945
slepp wants to merge 1 commit into
mainfrom
fix/hew-test-project-root

Conversation

@slepp

@slepp slepp commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

hew test compiled each harness from a staged copy in a temporary directory, so the compiler inferred that directory as the project root and no cross-file import resolved inside any test. Harnesses now compile in memory against the original test path with the project root threaded through, making test-time import resolution identical to hew run. A multi-file fixture and a string-path regression pin the behaviour.

Verification

  • cargo test -p hew-cli --test test_runner_e2e: 30 passed, 0 failed
  • cargo test -p hew-cli --bin hew test_runner: 27 passed, 0 failed
  • Full CLI preflight: pass
  • Compiled ratchet: 0 new failures
  • Preflight: ready-to-push

Out of scope

  • Test-runner discovery rules and layout conventions are unchanged; only where harnesses compile from is different.
  • Package-level import surface for *_test.hew peers is handled separately and untouched here.

I compile generated test harnesses in memory with the original test path and the invocation project root. This keeps package and file-relative imports aligned with hew run while preserving per-test process isolation.

I add multi-file project and string-import regressions alongside the existing test-runner coverage.
@slepp
slepp enabled auto-merge (squash) August 13, 2026 22:14
@gertybotbot

Copy link
Copy Markdown
Contributor

CI is red because the new hew-cli/tests/test_project_root_fixture/tests/project_root_test.hew is swept by make hew-check-all outside hew test; its standalone check starts at tests/, so test_project_root::answer cannot resolve. The e2e test covers the hew test path, but please either make the fixture independently checkable or exclude/classify it in the corpus sweep.

@slepp

slepp commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

The red check is deterministic: hew-check-all compiles project_root_test.hew standalone from its tests/ directory, so test_project_root::answer cannot resolve. Current main still reproduces the underlying hew test project-root failure, so the feature is not superseded, but this branch now conflicts with #2958. The fix needs a rebase that preserves the package-FFI test path plus a corpus-safe fixture arrangement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants