Skip to content

lint: flag raw mise dispatch in BATS tests #38

Description

@brownie-ricon

Problem

BATS tests for mise-backed tools should call the tool wrapper, not reconstruct the task dispatch path inline.

Bad shape observed during KnickKnackLabs/notes#15 work:

run env ... bash -c 'cd "$REPO_DIR" && mise run -q lock'

That is close to real execution, but still bypasses the suite's exported tool wrapper (notes lock). It makes the test less readable, can skip wrapper-owned environment setup (CALLER_PWD, stderr handling, future shiv/caller-cwd behavior), and encourages each test to grow a tiny bespoke dispatcher.

Proposed lint

Warn on raw mise dispatch in BATS test bodies:

  • mise run ... in test/*.bats;
  • bash -c '... mise run ...' in test/*.bats;
  • direct .mise/tasks/... execution.

Allowlist:

  • the canonical wrapper definition in test/test_helper.bash / test/helpers.bash;
  • tests whose purpose is explicitly to verify mise dispatch itself, with an inline allow comment.

Suggested diagnostic:

Call the tool wrapper (notes lock) instead of raw mise run; tests should exercise the same path a user/shiv shim does.

Related

  • fold bats-tool-testing.md — "Call the Tool, Not the Script"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions