{"name":"@putout/plugin-convert-mock-require-to-mock-import","version":"2.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability to convert mockRequire to mockImport","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-mock-require-to-mock-import#readme","main":"lib/convert-mock-require-to-mock-import.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git://github.com/coderaiser/putout.git"},"scripts":{"test":"madrun test","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"},"dependencies":{},"keywords":["putout","putout-plugin","plugin","convert","mock-require","mock-import"],"devDependencies":{"@putout/test":"^4.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^13.0.0","madrun":"^8.0.1"},"peerDependencies":{"putout":">=24"},"license":"MIT","engines":{"node":">=14"},"publishConfig":{"access":"public"},"gitHead":"3a79ca2d5b5b69feb51c2d76b8beeacf84cf745c","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-convert-mock-require-to-mock-import@2.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.3.0","dist":{"integrity":"sha512-5ATGUwzolLYWmTeubvX0g7ejVP5rIL5hN+T+1sUnPpdOi8JykJj36HtbBYAcTOCckIJ0T0XnEmyo7naLoysBNw==","shasum":"5afae67f9ff07350423dd1e7bbde90bef536f9b4","tarball":"http://registry-npm.ywwl.com/@putout/plugin-convert-mock-require-to-mock-import/download/@putout/plugin-convert-mock-require-to-mock-import-2.0.0.tgz","fileCount":4,"unpackedSize":5311,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6c2HCRA9TVsSAnZWagAA91QP/0mwTSeuTifcntnKLw8w\nCH1oRrzIcIaXthMOQwTP18drTP6IbRn9gAmyaNRou3QXMiNdQaTb64DiwbjC\nlSgVX6znuVyVq5Zj5aiwCoXICsJ+tf5jTwvp8CZN7i4LkA4HcaJ0YZgpY7Pk\nGvz8RtK+yvCc89lyzemyLYJiA7q6g9TkBcSIFbbs422bL+1r/9QKB2SuuzEN\nfTnF7kCqXBP8EOE00GlQvT6Jp7lPih9bQtaEaxQOZ6NiKzxUv8XwTJsYeRIF\n9xCWkiu4WlRYPU3/XJbliaJWASGhKOMDCoOMdPHegwQWSXupIYgP3m9JaoFe\nBQfyaxSDBksRMs0m0xznGUrv372ylUklmmJQyNfmFEAS6EbMEeMvHvO6XalO\nxxSBdevD2N5ER1RerbdhvdXqmQQW9FjzZv06VZ35/3qFg2QDoumlDMCxIMMj\nDVMuhauiIiFaMPLTUtSMIwcwqPl1RlXighrrjCaXquMPZ62lXf+lIFcTjQHf\nAAJbPOXBt6HA7qI85e1FBO+kC6nbef3MnpJuAoht/bg/unMQZwk2/vGOGWAd\nzpkjuDM0JKsjmTyg6T9O1Iewv6IxP21Ydr82TgeDkfRMiW3xGXZi2p4X7q96\nuVkjdVNju90g4yTDgDyySOtZ0mjxmbS3LUBAX04B5qyCVKrcaZDzM2AwI/gx\nxFkv\r\n=FFqD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGDxOYol4aLZFGtm12aJ9pu2bmGIsWxek5HSBjTzCrXdAiEAkogWNUxz9QWh3pItIoWDbOzVEhlDgu7sr2WuCF4CZiA="}],"size":2286,"noattachment":false,"key":"/@putout/plugin-convert-mock-require-to-mock-import/-/@putout/plugin-convert-mock-require-to-mock-import-2.0.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","tmp":"tmp/plugin-convert-mock-require-to-mock-import_2.0.0_1642712455076_0.7194686722654231"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-convert-mock-require-to-mock-import [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-mock-require-to-mock-import.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-mock-require-to-mock-import \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to convert [mockRequire](https://github.com/boblauer/mock-require) to [mockImport](https://github.com/coderaiser/mock-import). Moved to [`@putout/plugin-tape`](https://www.npmjs.com/package/@putout/plugin-tape).\n\n## Install\n\n```\nnpm i @putout/plugin-convert-mock-require-to-mock-import -D\n```\n\n## Rule\n\nRule `convert-mock-require-to-mock-import` is enabled by default for `*.mjs`, to disable add to `.putout.json`:\nGood complement of [@putout/plugin-tape](https://github.com/coderaiser/putout/tree/master/packages/plugin-tape#putoutplugin-tape-)\n\n```json\n{\n    \"rules\": {\n        \"convert-mock-require-to-mock-import\": \"off\"\n    }\n}\n```\n\n## ❌ Example of incorrect code\n\n```js\nconst mockRequire = require('mock-require');\n\nconst {reRequire, stopAll} = mockRequire;\n\ntest('', (t) => {\n    mockRequire('fs/promises', {\n        unlink: stub(),\n    });\n    \n    const fn = reRequire('..');\n    fn();\n    \n    stopAll();\n    t.end();\n});\n```\n\n## ✅ Example of correct code\n\n```js\nimport {createMockImport} from 'mock-import';\n\nconst {\n    mockImport,\n    reImport,\n    stopAll,\n} = createMockImport(import.meta.url);\n\ntest('', async (t) => {\n    mockImport('fs/promises', {\n        unlink: stub(),\n    });\n    \n    const fn = await reImport('..');\n    fn();\n    \n    stopAll();\n    t.end();\n});\n```\n\n## License\n\nMIT\n","publish_time":1642712455520,"_cnpm_publish_time":1642712455520,"dist-tags":{"latest":"4.1.1"}}