Repository navigation
fix(cli): wheels test runs user app specs instead of silent '0 passed' - #2337
Merged
Merged
Conversation
Three coordinated fixes — the bug surface was:
$ wheels test
Running core tests (sqlite)...
0 passed
with no spec discovery. Tutorial chapter 7 asks users to write specs and
run `wheels test`, but the CLI was hard-coded into core mode and pointed
at framework specs the user didn't write.
1. cli/lucli/Module.cfc + cli/lucli/services/TestRunner.cfc: drop the
broken auto-detection that defaulted to core mode whenever
vendor/wheels/tests/ existed. Every Wheels app vendors the framework's
tests there, so that signal can't tell user apps apart from the
framework repo. Default to app mode; users who explicitly want
framework specs pass --core (CLI) or type:"core" (service).
2. vendor/wheels/Public.cfc: when handling /wheels/app/tests, prefer the
project's own tests/runner.cfm (advanced users), but fall back to a
built-in runner when none exists. Without this, fresh apps hit
'Page [/tests/runner.cfm] not found'.
3. vendor/wheels/tests/app-runner.cfm (new): minimal TestBox-driven
app-test runner. Scans tests.specs/ in the project root, emits the
same JSON shape as the framework's core runner (so the CLI's
displayTestResults parses it without a special case). Deliberately
does NOT include /wheels/tests/runner.cfm — that runner overrides
model/view/controller paths to framework test assets and hardcodes
the wheelstestdb_<db> datasource convention, neither of which fits
user apps.
Smoke spec at tests/specs/<anything>/SmokeSpec.cfc now runs and reports
counts. Fixes #2318.
Test plan:
- `bash tools/test-cli-local.sh` — 443 pass / 3 fail / 0 error. The 3
failures are pre-existing Doctor Service issues (#2260).
- TestRunnerSpec updated to assert detectTestType() now always returns
"app" with the issue ref in the test name.
- `bash tools/test-onboarding.sh` Phase 9 flips SKIP -> PASS:
"wheels test reports the smoke spec".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bug surface from the fresh-VM tutorial:
```
$ wheels test
Running core tests (sqlite)...
0 passed
```
— no spec discovery, no failure, no error. Tutorial chapter 7 asks users to write specs and run `wheels test`, but every invocation defaulted to core mode and pointed at framework specs the user didn't write.
Root cause (three layers)
Fix
1. `cli/lucli/Module.cfc` + `cli/lucli/services/TestRunner.cfc`
Default to app mode. `--core` (CLI flag) or `type: "core"` (service arg) is the explicit opt-in for framework specs. Updated `TestRunnerSpec` to assert the new behavior.
2. `vendor/wheels/Public.cfc::testbox()`
Prefer the project's `tests/runner.cfm` when it exists (advanced users with custom runners), but fall back to a new built-in runner when it doesn't.
3. `vendor/wheels/tests/app-runner.cfm` (new file)
Minimal TestBox-driven app-test runner. Scans `tests.specs.*` in the project root, emits the same JSON shape as the framework's core runner (so the CLI's `displayTestResults` parses it without a special case). Deliberately does NOT delegate to the framework runner — it would override paths and datasource in ways that break user tests.
Result
Smoke spec at `tests/specs/smoke/SimpleSpec.cfc`:
```cfm
component extends="wheels.WheelsTest" {
function run() {
describe("Simple smoke", () => {
it("can add", () => { expect(1 + 1).toBe(2); });
});
}
}
```
Now runs and reports counts via `wheels test`.
Test plan
Closes #2318