Have ideas to improve npm?Join in the discussion! »

    bats-mock

    1.0.1 • Public • Published

    bats-mock

    Mocking/stubbing library for BATS (Bash Automated Testing System)

    Installation

    Recommended installation is via git submodule. Assuming your project's bats tests are in test:

    git submodule add https://github.com/jasonkarns/bats-mock test/helpers/mocks
    git commit -am 'added bats-mock module'

    then in test/test_helper.bash:

    load helpers/mocks/stub

    sparse-checkout

    That is all that's necessary to get the stub helpers into your project. However, as a submodule, it pulls in this entire repo. If you'd like only the minimum necessary files, you'll need to configure the submodule for sparse-checkout.

    Enable sparse-checkout from the submodule directory:

    cd test/helpers/mocks
    git config core.sparsecheckout true

    Then configure explictly list the files you wish to have checked out. From the root of your project:

    echo stub.bash >> .git/modules/test/helpers/mocks/info/sparse-checkout
    echo binstub >> .git/modules/test/helpers/mocks/info/sparse-checkout

    Credits

    Extracted from the ruby-build test suite. Many thanks to its author and contributors: Sam Stephenson and Mislav Marohnić.

    Install

    npm i bats-mock

    DownloadsWeekly Downloads

    273

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar