Skip to content

fix(cli): run smoke tests under Bun and Node - #348

Draft
M-DGayle wants to merge 1 commit into
oblien:mainfrom
Madd-Technologies:fix/cli-smoke-bun-runtime
Draft

fix(cli): run smoke tests under Bun and Node#348
M-DGayle wants to merge 1 commit into
oblien:mainfrom
Madd-Technologies:fix/cli-smoke-bun-runtime

Conversation

@M-DGayle

Copy link
Copy Markdown
Contributor

Summary

Make the CLI smoke-test launcher select the correct preload arguments for the runtime executing Vitest.

Motivation

When the CLI suite runs directly on Bun 1.3.10, process.execPath points to Bun, but the smoke helper passes Node's --import tsx --import ... arguments to that executable. The real CLI process exits before rendering version or help output, causing three black-box smoke tests to fail.

The harness now uses Bun's supported --preload path when process.versions.bun is present and preserves the existing tsx loader path under Node.

Related issue

None.

Changes

  • apps/cli: detect the active runtime in the E2E smoke helper.
  • Use --preload for Bun and retain --import tsx --import for Node.
  • No production CLI, dependency, lockfile, API, or generated-file changes.

Verification

Before the change in a Bun-only Linux environment:

$ bun run --cwd apps/cli test
Test Files  1 failed | 21 passed (22)
Tests       3 failed | 175 passed (178)

After the change:

$ bun run --cwd apps/cli test
Test Files  22 passed (22)
Tests       178 passed (178)

$ node /workspace/node_modules/vitest/vitest.mjs run  # Node 24
Test Files  22 passed (22)
Tests       178 passed (178)

$ bun run --cwd apps/cli lint
$ tsc --noEmit

$ bun run --cwd apps/cli build
ESM Build success
DTS Build success
[stage-server] staged API bundle + pglite + migrations + engine + lua

I also ran the root test command in Linux Docker. The CLI suite passed, but the root command is not green in a container because existing @repo/adapters and @repo/db tests assume /.dockerenv is absent and /etc/machine-id is stable. Root lint also stops in the existing apps/email script because its nested server package has no lint script.

prettier --check apps/cli/test/e2e/smoke.test.ts reports an existing formatting mismatch on both untouched main and this branch. git diff --check passes, and I left the unrelated formatting untouched.

Checklist

  • One change per PR — one bug, or one agreed feature, with nothing unrelated bundled in
  • The diff is scoped — no reformatting or lint fixes on lines I wasn't otherwise changing
  • A test fails without this change and passes with it (or I explained above why there isn't one)
  • bun run test, bun run --cwd <workspace> lint, and bun format all pass locally — targeted lint/tests/build pass; root/container and pre-existing formatting limitations are documented above
  • I understand every line of this diff and can explain it in review

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.

1 participant