GithubHelp home page GithubHelp logo

matchai / fish-mock Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 0.0 25 KB

๐ŸŸ๐ŸŽญ Quick and powerful fish shell mocks

License: ISC License

Shell 100.00%
fish fish-shell fisher testing mocking fish-packages

fish-mock's Introduction

Fish Performance arts masks

fish-mock

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.

Installation

fisher add matchai/fish-mock

Usage

$ mock

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

  Arguments
    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

  Examples
    $ 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

  Tips
    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 (\*).

License

ISC ยฉ Matan Kushner

fish-mock's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fish-mock's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.