Fish Performance arts masks


Quick and powerful fish shell mocks

Build Status Fish Version License

fish-mock provides a quick and easy way to override the behavior of commands for use when testing. Mocking commands causes them to behave predictably, allowing you isolate and focus on the code being tested.



fisher add matchai/fish-mock


$ mock

    $ mock <command> <argument> [exit code] [executed code]
    $ unmock <command>

    command        The command you would like to have mocked
    argument       The argument the mock should apply to ('*' defines a fallback for all arguments)
    exit code      The exit code returned when the command executes
    executed code  Code to be executed when the command is called with the given argument

    $ mock git pull 0 "echo This command successfully echoes"
    $ mock git push 1 "echo This command fails with status 1"
    $ mock git \*   0 "echo This command acts as a fallback to all git commands"
    $ unmock git      # Original git functionality is now restored

    To view this manual, use the mock command without providing arguments.
    The array of arguments ($argv) is accessible within mocked functions as $args.
    Many mocks can be applied to the same command at the same time with different arguments.
    Be sure to escape the asterisk symbol when using it as a fallback (\*).


ISC © Matan Kushner

Fish Mock

🐟🎭 Quick and powerful fish shell mocks

Fish Mock Info

⭐ Stars15
🔗 Source
🕒 Last Updatea year ago
🕒 Created4 years ago
🐞 Open Issues0
➗ Star-Issue RatioInfinity
😎 Authormatchai