{"name":"@putout/plugin-convert-mock-require-to-mock-import","version":"4.1.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":"f9b9e2f8d1b51447b789e404cf94657d987bed15","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_id":"@putout/plugin-convert-mock-require-to-mock-import@4.1.0","_nodeVersion":"18.4.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-4FkGCLh6xnyqrTnMyQiHZpbl7uNig8efvBuIPj9+LqTBqg79Wsv0EVLbzL/7c7hH0RFhUTICEW0tBJ9XIuM2Wg==","shasum":"e207e82334ad19033b167b166e72f78325fd04b8","tarball":"http://registry-npm.ywwl.com/@putout/plugin-convert-mock-require-to-mock-import/download/@putout/plugin-convert-mock-require-to-mock-import-4.1.0.tgz","fileCount":4,"unpackedSize":5377,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSnaY0is5+0/yMjzNbOnKsTqlG6Vmc9yZxW8eNGE79TQIgfjLEmufCZIu38lpVsLPh+N7zKELQaHBI/VZZgsGd6vE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisITMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoG9Q/+JBzH9GDhll1BqZrKBHcN+2acgVi94vAhK4BUUORVjsnbwLuF\r\nQ7/BHVbhRtg0WnoVfibdweHWLZkuchvNTLE4Ls5XzAXLU25wsU+VP8KyjYMU\r\nrLas6ws87OlHqDcZpwyQSYU4ifgJOqHhMGi6XZpezUaHIg4Mph+J2GhAZsGn\r\nxzLuh/XynuJHb2lCbt4ejHkbMymBeClw8/wBLUMytZv8yzOcgJOAXhrFVnnJ\r\nG2iSADZBPsYuNn04DgsPMATUxEiS7Lcx8tHZz/Dm5H5pi3JWfvqcEZxoz59L\r\n1ANc3WCSEtbSRggL3z4qFE2ZvL+RKRJcrVEkP/cGUaxx76Hd3p+gf/Sa6Zxj\r\nmkMlTahwrDYo7MmQGcdAcZA6WQyfiYQ+uK1XJ0KaSoMWSZMX9cOZ9DuvtAqM\r\nEA84OueEwA3t9ASphAPhZRBNxbBUAiQSp4rWDVFCnUkWDJw+Eejf6wBtKzN5\r\n+Ry1mNtHQMGEXpZBeHBszYAPnKpGzHgSCt0lE3nmnNVZLxE/A/jmh2eBNxQR\r\nqpHPyJjh5SZhOCdgnbtTtwwchtIA7tv8MJ73uOAB66voJmyq44CQa9tkd8Zb\r\nFOAYyzVEwpZS7PAXPL6+BuX1/fR2Msw0Lk3fPRhPFHyfJQjS2sWUPFSb64bR\r\n0MzF+YZj8JffpyWk1wKXm1IVhYPzTlbKU7s=\r\n=EIt4\r\n-----END PGP SIGNATURE-----\r\n","size":2331,"noattachment":false,"key":"/@putout/plugin-convert-mock-require-to-mock-import/-/@putout/plugin-convert-mock-require-to-mock-import-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","tmp":"tmp/plugin-convert-mock-require-to-mock-import_4.1.0_1655735500764_0.22717127451615204"},"_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":1655735500906,"_cnpm_publish_time":1655735500906,"dist-tags":{"latest":"4.1.1"}}