{"name":"@putout/plugin-convert-mock-require-to-mock-import","version":"4.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/plugin-tape":"*","@putout/test":"^5.0.0","c8":"^7.5.0","eslint":"^8.0.1","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^15.0.0","madrun":"^9.0.0"},"peerDependencies":{"putout":">=26"},"license":"MIT","engines":{"node":">=16"},"publishConfig":{"access":"public"},"gitHead":"8050b262216edcdc06e3db6e9ec5adbb6fcf1892","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-convert-mock-require-to-mock-import@4.0.0","_nodeVersion":"18.3.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-XXb12oG6UFQ6Ss4My6g4CmW/JsFZIoh5eYQ7juZeCUSwc8lbiI2aHoG9ZSDr4uXPT9sO21zEGBIV4qMP4hTdmg==","shasum":"63a3d1035dd7f0b3372a8ca78d4cc1bd17017e79","tarball":"http://registry-npm.ywwl.com/@putout/plugin-convert-mock-require-to-mock-import/download/@putout/plugin-convert-mock-require-to-mock-import-4.0.0.tgz","fileCount":4,"unpackedSize":4914,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqc/IGJQ+kOWkcfKA5mzi2rzpxUZGhpSuT1j+vYeMWVAIhAOyVj8etO0v2Ib0wfNqyawQRa93gJEFqSsTVff15n6+z"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisEA1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfKQ//Qns5qGF/6tOCtdD3hxLkQAlYeyXk9clXkjC3Oknl1EX3MTXP\r\nfrej6OU31mv9cme8gJhZf6ZWWMLGdyuvZzJL8861xUxXuPpVa/e2HsxhAKd4\r\nN/S25U1kF1DI9grpK3fLVdW6Pvt76Wa+kGOi9iPHL4wnQ2CFp+yVTlhUv0G6\r\nnjJRlj/uNjX0zBj3ZJwRZ2M/8S9zM/vgIpnuC9N6Gmk2p/+/c1E+mNFjyYMt\r\nLfEF1roeO3GoNsgT7NAn0lNVK7XQEVXV0TsJa4RDpzZQrTwZ7Aam18hbr7Mr\r\nr4zS5qa8WQCTH/XkuhUc8f9FYz8KEDi0go0MEXZOJdwhtsSX+TyGNwwoReeQ\r\nozEUsw6EGAiyR8vxPVrPIlh1eyDK+IzPPLb2xK1f7quEcx4Cbs94xHqxXi/h\r\nZ90PcklqvLHdatfwMLiIbricP8tA8ChZXRfditdo4wX54ljWG4zp7To56vTN\r\n4krNgr3z2KJOsIzLVOqu4CKDWfXugsAWFtqUrdQUddAlIQ2PBLkG+xmt6MHT\r\nnXOMeSIZ48SKo2MR7MDkaVwaiOIVPtwImuuGeqrpS/QxVLbPaoZb+qN8bTBi\r\nN2ps72lLP4skpPzcukj/9vpWTayMQDONDnjKGMdngrxTz2xnDFXqfjkam4Uj\r\nLX/IbVVLCwdOVLv6mVF2FsWlLoAs3XU9cxM=\r\n=mS4x\r\n-----END PGP SIGNATURE-----\r\n","size":2193,"noattachment":false,"key":"/@putout/plugin-convert-mock-require-to-mock-import/-/@putout/plugin-convert-mock-require-to-mock-import-4.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_4.0.0_1655717941654_0.9829729431526244"},"_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":1655717941837,"_cnpm_publish_time":1655717941837,"dist-tags":{"latest":"4.1.1"}}