{"name":"@putout/plugin-convert-mock-require-to-mock-import","version":"1.0.1","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"putout plugin adds ability to convert mockRequire to mockImport","homepage":"http://github.com/coderaiser/putout","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":"^3.0.0","c8":"^7.5.0","eslint":"^7.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^7.0.0","madrun":"^8.0.1"},"peerDependencies":{"putout":">=15"},"license":"MIT","engines":{"node":">=14"},"publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-convert-mock-require-to-mock-import@1.0.1","_nodeVersion":"15.9.0","_npmVersion":"7.5.3","dist":{"integrity":"sha512-dSaDAgZgL+JllZt0/vBQE/BamlCGHFTg6hQE7Soz5mHDP0GttU8y14J2pCqkr/epEWmaZZf50RU6/ryYWxKgwg==","shasum":"f9445eea1572b4346759104f665b73a638d0d9d8","tarball":"http://registry-npm.ywwl.com/@putout/plugin-convert-mock-require-to-mock-import/download/@putout/plugin-convert-mock-require-to-mock-import-1.0.1.tgz","fileCount":4,"unpackedSize":5644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgM4Z/CRA9TVsSAnZWagAAVjoP/1gwJkazpb6hhfKGwBCO\nTyZDYsi5WLEIJ2BTGEGiDzW9CzYXwcA5w+LtgTOOqvbCeI5aYSylxDT0XD7T\nv6Pv6Ozn1i3+2EDXqPRj7e/EVpwTsWoYGsJaqkVzZptyRTU06BQycdyyxG9L\n0zBloOxEvq06p8RPZ/J+dcmMLTm3w7Hl1R1owkYFDvp4Y9dtp2eprtwotaNf\nQ3FbwEK+paFmdsHfC7RaepNHqauUjV5KlzwkLn6iKWVhJD5Od8rOMIDUXl27\nQJGvEYvFtp35vmE1pEQTTD8D80ZcMYxTA1MZojiJKTbYmDf4iIkZa1SqHQBI\n9Qhg3JyeIWbl5yPXmwTO+Q5WaSA/XABhX665FpUh3QjD96rhxyEog+qVfu+l\nYVPVW+s999s7j+Rk6pjYKKWKccH+faGPHEdGsCenD25Egv3esPiEbEh/AZ1M\nmTqWCFTazd5ZAY96mwVhpk3MhmO1AWuSmyE/ZCUlIagIJ1xzXPtycNhWfI1t\n5rp3fBZLriQjaUyAriMryLcFXVLQdgeGIyah4moch+m6HvV3wFhVodKLTdLL\ntykp63TbX8cIkMuPEivNjIq1m8rrdzx3Xs6gOnprfLkg4lsDes8J5EwECOeE\ny/bT7BTIec6lUEzQEeW+hb8Lxj8M1TJtpWdCViAxC+jlfWMABpmMpdqok80i\nZ18W\r\n=nI0+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBmsB9YQXU2JH4Yv9GDaiEluMz51WuzFstpelINGCtdDAiEAjQ9lItB4ttk2DFwhBdNvX+431w8LzMu2Fl5ITXmabas="}],"size":2374,"noattachment":false,"key":"/@putout/plugin-convert-mock-require-to-mock-import/-/@putout/plugin-convert-mock-require-to-mock-import-1.0.1.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_1.0.1_1613989503566_0.6729723298695727"},"_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":1613989503700,"_cnpm_publish_time":1613989503700,"dist-tags":{"latest":"4.1.1"}}