Skip to content

allow a forced unstub mode without plans validation - #49

Open
e-picas wants to merge 1 commit into
jasonkarns:mainfrom
e-picas:feat-allow-forced-unstub
Open

allow a forced unstub mode without plans validation#49
e-picas wants to merge 1 commit into
jasonkarns:mainfrom
e-picas:feat-allow-forced-unstub

Conversation

@e-picas

@e-picas e-picas commented Jul 7, 2024

Copy link
Copy Markdown

Introduce the ability to "force" an unstub without verficiation of the stub plans. The idea is to not fail if some invocations are delcared for the stubbed command but not used.

It adds a new parameter to the unstub function: unstub <cmd> [forced=false].
The default behaviour is to keep the validation and fail if some plans were not called.


Dependencies before to merge:

@e-picas e-picas changed the title feat: allow a forced unstub mode without plans validation allow a forced unstub mode without plans validation Jul 7, 2024
jgrigg added a commit to jgrigg/bats-mock that referenced this pull request Aug 22, 2026
--allow-missing only suppresses the "never stubbed" case; it does not
forgive an unfulfilled plan on a stub that does exist. That's what
upstream's "forced unstub mode without plans validation"
(jasonkarns#37/jasonkarns#49) asks for, and what --force now provides.

Upstream implements this as a second positional argument (unstub <cmd>
true); this fork uses a named flag instead, matching the existing
--allow-missing convention. Flags parse in either order via a small
while-loop.

--force skips calling binstub in END mode entirely, matching upstream's
actual mechanism -- so unlike every other unstub path, a forced unstub
produces no debug() output. Cleanup still happens unconditionally.
jgrigg added a commit to jgrigg/bats-mock that referenced this pull request Aug 22, 2026
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