{"name":"@supertape/operator-stub","version":"4.1.0","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"supertape stub operator","homepage":"http://github.com/coderaiser/supertape","main":"./lib/stub.js","release":false,"tag":false,"changelog":false,"type":"module","repository":{"type":"git","url":"git+https://github.com/coderaiser/supertape.git"},"scripts":{"test":"madrun test","test:dts":"madrun test:dts","watch:test":"madrun watch:test","lint":"madrun lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","fix:lint":"madrun fix:lint","coverage":"madrun coverage","report":"madrun report","wisdom":"madrun wisdom"},"dependencies":{"@cloudcmd/stub":"^5.0.0"},"keywords":["operator","stub","function","tap","tape","testing"],"devDependencies":{"check-dts":"^1.0.0","eslint":"^10.0.2","eslint-plugin-putout":"^31.0.1","madrun":"^13.0.0","mock-require":"^3.0.2","nodemon":"^3.0.1","putout":"^42.0.17","superc8":"^12.0.0","supertape":"^13.0.0","typescript":"^6.0.2"},"license":"MIT","engines":{"node":">=22"},"publishConfig":{"access":"public"},"_id":"@supertape/operator-stub@4.1.0","gitHead":"76597483b06495e363b0cd1a7d752ec064117647","types":"./lib/stub.d.ts","bugs":{"url":"https://github.com/coderaiser/supertape/issues"},"_nodeVersion":"26.5.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-tlkivgeZeVjfRSB7/SIMg0NeYW2pamjaUCwPNcogw7K1nHteNVWaoBe4gbW+vm0cfB9F+IOtdEi6BgRBwKXlgQ==","shasum":"0669eab8b525c9b214e47497f7a508d3f32fa975","tarball":"http://registry-npm.ywwl.com/@supertape/operator-stub/download/@supertape/operator-stub-4.1.0.tgz","fileCount":5,"unpackedSize":12386,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBBKaPl/jcX4mrEVzgheFTIGmgRiZFanQuWrdXg8Nvs0AiB5LSIyzlH54vq67JkUGFns+6RuKJlwbjQHiAZZ9VYnvg=="}],"size":3318,"noattachment":false,"key":"/@supertape/operator-stub/-/@supertape/operator-stub-4.1.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/operator-stub_4.1.0_1783932740680_0.4187060269307745"},"_hasShrinkwrap":false,"readme":"# @supertape/operator-stub [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/supertape.svg?style=flat&longCache=true\n[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/supertape/master.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/supertape \"npm\"\n[BuildStatusURL]: https://travis-ci.org/coderaiser/supertape \"Build Status\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/supertape?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/supertape/badge.svg?branch=master&service=github\n\n`supertape` operator simplifies work with [@cloudcmd/stub](https://github.com/cloudcmd/stub).\n\n## Install\n\n```\nnpm i @supertape/operator-stub -D\n```\n\n## Operators\n\nAdds next operators to work with:\n\n### t.calledWith(fn, args [, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function call', (t) => {\n    const fn = stub();\n    \n    fn('hello', 'world');\n    \n    t.calledWith(fn, ['hello', 'world'], 'fn should be called with \"hello\", \"world\"');\n    t.end();\n});\n```\n\n### t.calledWithNoArgs(fn[, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called with no args', (t) => {\n    const fn = stub();\n    \n    fn();\n    \n    t.calledWithNoArgs(fn);\n    t.end();\n});\n```\n\n### t.calledCount(fn, count[, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called count', (t) => {\n    const fn = stub();\n    \n    fn();\n    fn();\n    \n    t.calledCount(fn, 2);\n    t.end();\n});\n```\n\n### t.calledOnce(fn [, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called once', (t) => {\n    const fn = stub();\n    \n    fn('hello');\n    \n    t.calledOnce(fn);\n    t.end();\n});\n```\n\n### t.calledTwice(fn, count[, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called twice', (t) => {\n    const fn = stub();\n    \n    fn('hello');\n    fn('world');\n    \n    t.calledTwice(fn);\n    t.end();\n});\n```\n\n### t.calledWithNew(fn, count[, message])\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called with new', (t) => {\n    const fn = stub();\n    \n    new fn();\n    \n    t.calledWithNew(fn);\n    t.end();\n});\n```\n\n### t.calledBefore(fn1, fn2[, message])\n\nCheck that `fn1` called before `fn2`.\nDo not forget to set names of stubs.\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called with new', (t) => {\n    const init = stub().withName('init');\n    const show = stub().withName('show');\n    \n    init();\n    show();\n    \n    t.calledBefore(show, init);\n    t.end();\n});\n```\n\n### t.calledAfter(fn1, fn2[, message])\n\nCheck that `fn1` called after `fn2`.\nDo not forget to set names of stubs.\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called with new', (t) => {\n    const init = stub().withName('init');\n    const show = stub().withName('show');\n    \n    init();\n    show();\n    \n    t.calledAfter(init, show);\n    t.end();\n});\n```\n\n### t.calledInOrder([fn1, fn2, fnN][, message])\n\nCheck that array of stubs `fns` called in order;\nDo not forget to set names of stubs.\n\n```js\nimport test, {stub} from 'supertape';\n\ntest('function called with new', (t) => {\n    const init = stub().withName('init');\n    const show = stub().withName('show');\n    \n    init();\n    show();\n    \n    t.calledInOrder([init, show]);\n    t.end();\n});\n```\n\n## License\n\nMIT\n","publish_time":1783932740816,"_cnpm_publish_time":1783932740816,"dist-tags":{"latest":"4.1.0"}}