Skip to content

fix(cli): wheels test runs user app specs instead of silent '0 passed' - #2337

Merged
bpamiri merged 1 commit into
developfrom
claude/fix-2318-wheels-test
Apr 27, 2026
Merged

bpamiri merged 1 commit into
developfrom
claude/fix-2318-wheels-test

Conversation

@bpamiri

@bpamiri bpamiri commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

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)

  1. CLI auto-detection was wrong. `Module.cfc::test` and `TestRunner.cfc::detectTestType` both keyed off "does `vendor/wheels/tests/` exist?" — but every Wheels app has the framework's tests vendored there, so the check was always true. `coreTests` defaulted to `true` for users.
  2. App-mode endpoint had no usable runner. `Public.cfc::testbox()` (handler for `/wheels/app/tests`) just `include`d `/tests/runner.cfm` from the project root. `wheels new` doesn't scaffold one, so fresh apps got `Page [/tests/runner.cfm] not found`.
  3. Reusing the framework's runner doesn't fit. `vendor/wheels/tests/runner.cfm` overrides `controllerPath`/`viewPath`/`modelPath` to framework test assets and hardcodes the `wheelstestdb_` datasource convention. Pointing user tests at it would break them.

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

  • `bash tools/test-cli-local.sh` — 443 pass / 3 fail / 0 error. The 3 failures are pre-existing Doctor Service issues (packages: doctor mixin-collision scan is regex-based and may miss metadata-driven mixins #2260) unrelated to this change.
  • `TestRunnerSpec` updated (one test rewritten to assert new "always returns app" behavior; cleanup test still asserts app mode without vendor dir).
  • `bash tools/test-onboarding.sh` Phase 9 flips SKIP → PASS: "wheels test reports the smoke spec".

Closes #2318

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".
@bpamiri
bpamiri merged commit 2044ba0 into develop Apr 27, 2026
4 checks passed
@bpamiri
bpamiri deleted the claude/fix-2318-wheels-test branch April 27, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): wheels test reports '0 passed' with no spec list, failures, or errors

1 participant