{"name":"@putout/plugin-tape","version":"17.0.0","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"🐊Putout plugin helps with tests","homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-tape#readme","main":"lib/index.js","release":false,"tag":false,"changelog":false,"repository":{"type":"git","url":"git+https://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"],"devDependencies":{"@putout/eslint-flat":"^2.0.0","@putout/plugin-putout":"*","@putout/test":"^12.0.0","c8":"^10.0.0","eslint":"^9.0.0","eslint-plugin-n":"^17.0.0","eslint-plugin-putout":"^25.0.1","madrun":"^10.0.0","montag":"^1.2.1","nodemon":"^3.0.1"},"peerDependencies":{"putout":">=38"},"license":"MIT","engines":{"node":">=18.6"},"publishConfig":{"access":"public"},"_id":"@putout/plugin-tape@17.0.0","gitHead":"3b227127a4b3eedd27245e75da85e5c857c9aaf3","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"_nodeVersion":"22.14.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-9TVpIkt7/YUCfsyEq2OD4TLA8JELIeGeGcWNVD1Rmk5O/nx39VsvBURlhXX1LrDfQNxtYv/yICPg3AchWDuLgA==","shasum":"e4913e8d68a249e46531023038526d7d68709a49","tarball":"http://registry-npm.ywwl.com/@putout/plugin-tape/download/@putout/plugin-tape-17.0.0.tgz","fileCount":40,"unpackedSize":56356,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCLTVvG3iueplD6Pa2KX01FykUJ989x5W5YtRFCVeTK0QIhAK12cTgEYvC7qIta/K7C67AmYjVnCYIxpqv2G8whGyGG"}],"size":12373,"noattachment":false,"key":"/@putout/plugin-tape/-/@putout/plugin-tape-17.0.0.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-tape_17.0.0_1742069289529_0.18701281297310457"},"_hasShrinkwrap":false,"readme":"# @putout/plugin-tape [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-tape.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-tape\"npm\"\n\n> Tape-inspired TAP-compatible simplest high speed test runner with superpowers.\n>\n> (c) 📼[**Supertape**](https://github.com/coderaiser/supertape)\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin helps to apply best parctises for tests written with 📼[**Supertape**](https://github.com/coderaiser/supertape).\n\n## Install\n\n```\nnpm i @putout/plugin-tape -D\n```\n\n## Rules\n\n- ✅ [add-args](#add-args);\n- ✅ [add-await-to-re-import](#add-await-to-re-import);\n- ✅ [add-node-prefix-to-mock-require](#add-node-prefix-to-mock-require);\n- ✅ [add-stop-all](#add-stop-all);\n- ✅ [add-t-end](#add-t-end);\n- ✅ [apply-destructuring](#apply-destructuring);\n- ✅ [apply-stub](#apply-stub);\n- ✅ [apply-with-name](#apply-with-name);\n- ✅ [convert-called-with-args](#convert-called-with-args);\n- ✅ [convert-called-with-no-args-to-called-with](#convert-called-with-no-args-to-called-with);\n- ✅ [convert-called-with-to-called-with-no-args](#convert-called-with-to-called-with-no-args);\n- ✅ [convert-deep-equal-to-equal](#convert-deep-equal-to-equal);\n- ✅ [convert-does-not-throw-to-try-catch](#convert-does-not-throw-to-try-catch);\n- ✅ [convert-emitter-to-promise](#convert-emitter-to-promise);\n- ✅ [convert-equal-to-called-once](#convert-equal-to-called-once);\n- ✅ [convert-equal-to-deep-equal](#convert-equal-to-deep-equal);\n- ✅ [convert-equal-to-not-ok](#convert-equal-to-not-ok);\n- ✅ [convert-equal-to-ok](#convert-equal-to-ok);\n- ✅ [convert-equals-to-equal](#convert-equals-to-equal);\n- ✅ [convert-match-regexp-to-string](#convert-match-regexp-to-string);\n- ✅ [convert-mock-require-to-mock-import](#convert-mock-require-to-mock-import);\n- ✅ [convert-ok-to-called-with](#convert-ok-to-called-with);\n- ✅ [convert-ok-to-match](#convert-ok-to-match);\n- ✅ [convert-tape-to-supertape](#convert-tape-to-supertape);\n- ✅ [convert-throws-to-try-catch](#convert-throws-to-try-catch);\n- ✅ [declare](#declare);\n- ✅ [jest](#jest);\n- ✅ [remove-default-messages](#remove-default-messages);\n- ✅ [remove-only](#remove-only);\n- ✅ [remove-skip](#remove-skip);\n- ✅ [remove-stop-all](# [remove-stop-all);\n- ✅ [remove-useless-not-called-args](#remove-useless-not-called-args);\n- ✅ [remove-useless-t-end](#remove-useless-t-end);\n- ✅ [switch-expected-with-result](#switch-expected-with-result);\n- ✅ [sync-with-name](#sync-with-name);\n\n## Config\n\n```json\n{\n    \"rules\": {\n        \"tape/convert-mock-require-to-mock-import\": \"off\",\n        \"tape/jest\": \"on\",\n        \"tape/apply-stub\": \"on\",\n        \"tape/apply-destructuring\": \"on\",\n        \"tape/apply-with-name\": \"on\",\n        \"tape/add-t-end\": \"on\",\n        \"tape/add-stop-all\": \"on\",\n        \"tape/add-await-to-re-import\": \"on\",\n        \"tape/add-node-prefix-to-mock-require\": \"on\",\n        \"tape/remove-useless-t-end\": \"on\",\n        \"tape/sync-with-name\": \"on\",\n        \"tape/switch-expected-with-result\": \"on\",\n        \"tape/convert-tape-to-supertape\": \"on\",\n        \"tape/convert-throws-to-try-catch\": \"on\",\n        \"tape/convert-does-not-throw-to-try-catch\": \"on\",\n        \"tape/convert-called-with-args\": \"on\",\n        \"tape/convert-called-with-to-called-with-no-args\": \"on\",\n        \"tape/convert-called-with-no-args-to-called-with\": \"on\",\n        \"tape/convert-equal-to-called-once\": \"on\",\n        \"tape/convert-equal-to-deep-equal\": \"on\",\n        \"tape/convert-equals-to-equal\": \"on\",\n        \"tape/convert-deep-equal-to-equal\": \"on\",\n        \"tape/convert-emitter-to-promise\": \"on\",\n        \"tape/convert-ok-to-match\": \"on\",\n        \"tape/convert-ok-to-called-with\": \"on\",\n        \"tape/convert-match-regexp-to-string\": \"on\",\n        \"tape/add-args\": \"on\",\n        \"tape/declare\": \"on\",\n        \"tape/remove-default-messages\": \"on\",\n        \"tape/remove-useless-not-called-args\": \"on\",\n        \"tape/remove-only\": \"on\",\n        \"tape/remove-skip\": \"on\",\n        \"tape/remove-stop-all\": \"on\"\n    }\n}\n```\n\n## jest\n\n🐊**Putout** gives ability to switch easily from [**Jest**](https://github.com/coderaiser/putout/blob/master/packages/plugin-jest/README.md#putoutplugin-jest-) to 📼**Supertape**. Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/e610ded68d5808c2dbc09a1f84be8a96/c8f515668b5bdf16b58ef85c3ca13d93682f3ccb).\n\n### ❌ Example of incorrect code\n\n```js\nit('should equal', () => {\n    expect(a).toEqual(b);\n});\n```\n\n### ✅ Example of correct code\n\n```js\nimport {test} from 'supertape';\n\ntest('should equal', () => {\n    t.equal(a, b);\n    t.end();\n});\n```\n\n## switch-expected-with-result\n\n📼**Supertape** uses more natural way of\ncomparing: first you pass `result` and then `expected`.\n\nIt gives you ability to use value instead of `expected` and\nunderstand code faster: no need to search for a second argument.\nWhile `result` is always a variable, so it most likely much shorter.\n\n### ❌ Example of incorrect code\n\n```js\ntest('plugin-apply-destructuring: transform: array: destructuring', (t) => {\n    t.equal(expected, result);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('plugin-apply-destructuring: transform: array: destructuring', (t) => {\n    t.equal(result, expected);\n    t.end();\n});\n```\n\n## convert-tape-to-supertape\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('tape');\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\n```\n\n## convert-throws-to-try-catch\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\n\ntest('some message', (t) => {\n    t.throws(copymitter, /from should be a string!/, 'should throw when no args');\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst tryCatch = require('try-catch');\nconst test = require('supertape');\n\ntest('some message', (t) => {\n    const [error] = tryCatch(copymitter);\n    \n    t.equal(error.message, 'from shoulde be a string!', 'should throw when no args');\n    t.end();\n});\n```\n\n## convert-does-not-throw-to-try-catch\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\n\ntest('some message', (t) => {\n    t.doesNotThrow(copymitter, 'should throw when no args');\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst tryCatch = require('try-catch');\n\ntest('some test', (t) => {\n    const [error] = tryCatch(copymitter);\n    \n    t.notOk(error, 'should not throw when no args');\n    t.end();\n});\n```\n\n## convert-called-with-args\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWith(fn, 'hello');\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWith(fn, ['hello']);\n    t.end();\n});\n```\n\n## convert-equal-to-called-once\n\nNo need to use [`equal`](https://github.com/coderaiser/supertape#tequalactual-expected-msg), [`supertape`](https://github.com/coderaiser/supertape) supports [`calledOnce`](https://github.com/coderaiser/supertape/tree/master/packages/operator-stub#tcalledoncefn--message).\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.equal(fn.callCount, 1);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledOnce(fn);\n    t.end();\n});\n```\n\n## convert-deep-equal-to-equal\n\nUse [`equal`](https://github.com/coderaiser/supertape#tequalactual-expected-msg) when comparing with primitives, [`deepEqual`](https://github.com/coderaiser/supertape#tdeepequalactual-expected-msg) for [`Objects`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) and [`Arrays`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array);\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    t.deepEqual(x, 5);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    t.equal(x, 5);\n    t.end();\n});\n```\n\n## convert-called-with-to-called-with-no-args\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWith(fn);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWithNoArgs(fn);\n    t.end();\n});\n```\n\n## convert-called-with-no-args-to-called-with\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWithNoArgs(fn, [1, 2]);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n\ntest('some message', (t) => {\n    const fn = stub();\n    fn();\n    \n    t.calledWith(fn, [1, 2]);\n    t.end();\n});\n```\n\n## convert-emitter-to-promise\n\n### ❌ Example of incorrect code\n\n```js\ntest('copymitter', (t) => {\n    const cp = copymitter(from, to, ['1']);\n    \n    cp.on('end', (t) => {\n        t.end();\n    });\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst {once} = require('node:events');\n\ntest('copymitter', async (t) => {\n    const cp = copymitter(from, to, ['1']);\n    \n    await once(cp, 'end');\n    \n    t.end();\n});\n```\n\n## apply-destructuring\n\nCheck out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/adf238850271c0a4ad917e71bab8757c/4ff416c3d9f3de0930339c7a4929eb4b62461d1a).\n\n### ❌ Example of incorrect code\n\n```js\nconst test = require('supertape');\nconst {stub} = test;\n```\n\n### ✅ Example of correct code\n\n```js\nconst {test, stub} = require('supertape');\n```\n\n## apply-stub\n\nApply [stub](https://github.com/cloudcmd/stub) functions created. Look how it works in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d098a8c8d03a072a7f3981e3cfb1d7af/f1542bfa39513ac625b2a9cd9243cc06dee286c0).\n\n### ❌ Example of incorrect code\n\n```js\nconst a = async () => true;\nconst b = async () => {};\nconst c = async () => throwError('hello');\n\nconst d = async () => {\n    throw Error('hello');\n};\n```\n\n### ✅ Example of correct code\n\n```js\nconst a = stub().resolves(true);\nconst b = stub().resolves();\nconst c = stub().rejects(Error('hello'));\nconst d = stub().rejects(Error('hello'));\n```\n\n## apply-with-name\n\n### ❌ Example of incorrect code\n\n```js\ntest('should call init before show', (t) => {\n    const init = stub();\n    const show = stub();\n    \n    t.calledInOrder([init, show]);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('should call init before show', (t) => {\n    const init = stub().withName('init');\n    const show = stub().withName('show');\n    \n    t.calledInOrder([init, show]);\n    t.end();\n});\n```\n\n## sync-with-name\n\n### ❌ Example of incorrect code\n\n```js\ntest('should call init before show', (t) => {\n    const init = stub().withName('show');\n    const show = stub().withName('show');\n    \n    t.calledInOrder([init, show]);\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('should call init before show', (t) => {\n    const init = stub().withName('init');\n    const show = stub().withName('show');\n    \n    t.calledInOrder([init, show]);\n    t.end();\n});\n```\n\n## declare\n\n### `mockImport`\n\n#### ❌ Example of incorrect code\n\n```js\nimport {stub} from 'supertape';\n\nmockImport('fs/promises', {\n    readFile: stub().resolves(''),\n});\n```\n\n##### ✅ Example of correct code\n\n```js\nimport {stub} from 'supertape';\nimport {createMockImport} from 'mock-import';\n\nconst {\n    mockImport,\n    stopAll,\n    reImport,\n} = createMockImport(import.meta.url);\n\nmockImport('fs/promises', {\n    readFile: stub().resolves(''),\n});\n```\n\n### `test`\n\n#### ❌ Example of incorrect code\n\n```js\ntest('xxx', (t) => {\n    const a = stub();\n    t.end();\n});\n```\n\n#### ✅ Example of correct code\n\n```js\nimport {test, stub} from 'supertape';\n\ntest('xxx', (t) => {\n    const a = stub();\n    t.end();\n});\n```\n\n## add-node-prefix-to-mock-require\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/38f43d1972b3ebe37597022b42024cd5/ccd8cf8a3ff4a30c6dccc528358f9439f1fd366e).\n\n### ❌ Example of incorrect code\n\n```js\nmockRequire('fs/promises', {\n    readdir,\n});\n```\n\n### ✅ Example of correct code\n\n```js\nmockRequire('node:fs/promises', {\n    readdir,\n});\n```\n\n## add-args\n\n### ❌ Example of incorrect code\n\n```js\ntest('xxx', () => {\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('xxx', (t) => {\n    t.end();\n});\n```\n\n## add-t-end\n\n### ❌ Example of incorrect code\n\n```js\ntest('xxx', () => {});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('xxx', (t) => {\n    t.end();\n});\n```\n\n## add-await-to-re-import\n\n### ❌ Example of incorrect code\n\n```js\ntest('stop-all: should be called', (t) => {\n    const read = reImport('./read');\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('stop-all: should be called', async (t) => {\n    const read = await reImport('./read');\n    t.end();\n});\n```\n\n## add-stop-all\n\nWhen you write test mocking `ESM` with [`mockImport()`](https://github.com/coderaiser/mock-import#mockimportname-mock) never forget to call [`stopAll()`](https://github.com/coderaiser/mock-import#stopall) when you no longer need it. This leads to bugs in tests which are hard to find, each test should be checked with the one which pass when called alone but fail when called with others.\n\n### ❌ Example of incorrect code\n\n```js\ntest('stop-all: should be called', (t) => {\n    mockImport('fs/promises', {\n        readFile: stub(),\n    });\n    \n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('stop-all: should be called', (t) => {\n    mockImport('fs/promises', {\n        readFile: stub(),\n    });\n    \n    stopAll();\n    t.end();\n});\n```\n\n## remove-useless-t-end\n\n### ❌ Example of incorrect code\n\n```js\ntest('test: remove me', () => {\n    t.end();\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('test: remove me', () => {\n    t.end();\n});\n```\n\n## convert-ok-to-match\n\n### ❌ Example of incorrect code\n\n```js\nt.ok(result.includes('hello'));\n```\n\n### ✅ Example of correct code\n\n```js\nt.match(result, /hello/);\n```\n\n## convert-ok-to-called-with\n\n### ❌ Example of incorrect code\n\n```js\nt.ok(set.calledWith(1, 2));\n```\n\n### ✅ Example of correct code\n\n```js\nt.calledWith(set, [1, 2]);\n```\n\n## convert-equal-to-not-ok\n\n### ❌ Example of incorrect code\n\n```js\nt.equal(error, null);\n```\n\n### ✅ Example of correct code\n\n```js\nt.notOk(error);\n```\n\n## convert-equal-to-ok\n\n### ❌ Example of incorrect code\n\n```js\nt.equal(result, true);\n```\n\n### ✅ Example of correct code\n\n```js\nt.ok(result);\n```\n\n## convert-equal-to-deep-equal\n\n### ❌ Example of incorrect code\n\n```js\nconst expected = {\n    hello: 'world',\n};\n\nt.equal(error, expected);\nt.end();\n```\n\n### ✅ Example of correct code\n\n```js\nconst expected = {\n    hello: 'world',\n};\n\nt.deepEqual(error, expected);\nt.end();\n```\n\n## convert-equals-to-equal\n\nCheckout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/9a428ce99c5ec8966363a7a6da5bbba8/7441cbf7c8429b265259e7d67125fa138d7db19b).\n\n### ❌ Example of incorrect code\n\n```js\nt.equals(e.message, 'token should be a string!', 'should throw');\n```\n\n### ✅ Example of correct code\n\n```js\nt.equal(e.message, 'token should be a string!', 'should throw');\n```\n\n## convert-match-regexp-to-string\n\n### ❌ Example of incorrect code\n\n```js\nt.match(result, RegExp('hello'));\n```\n\n### ✅ Example of correct code\n\n```js\nt.match(result, 'hello');\n```\n\n## remove-default-messages\n\n📼**Supertape** will put this information for you, and it is always the same.\nNo need to repeat the same information twice on one line, better to avoid it.\n\n### ❌ Example of incorrect code\n\n```js\nt.equal(result, expected, 'should equal');\n```\n\n### ✅ Example of correct code\n\n```js\nt.equal(result, expected);\n```\n\n## remove-useless-not-called-args\n\n### ❌ Example of incorrect code\n\n```js\nt.notCalled(fn, []);\n```\n\n### ✅ Example of correct code\n\n```js\nt.notCalled(fn);\n```\n\n## remove-only\n\n### ❌ Example of incorrect code\n\n```js\ntest.only('some test', (t) => {\n    t.end();\n});\n\ntestDeclareBeforeReference.only('some test', (t) => {\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('some test', (t) => {\n    t.end();\n});\n\ntestDeclareBeforeReference('some test', (t) => {\n    t.end();\n});\n```\n\n## remove-skip\n\n### ❌ Example of incorrect code\n\n```js\ntest.skip('some test', (t) => {\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('some test', (t) => {\n    t.end();\n});\n```\n\n## remove-stop-all\n\nWhen `reImport()` or `reRequire` not called, `stopAll()` is redundant and should be removed.\n\n### ❌ Example of incorrect code\n\n```js\ntest('some test', (t) => {\n    stopAll();\n    t.end();\n});\n```\n\n### ✅ Example of correct code\n\n```js\ntest('some test', (t) => {\n    t.end();\n});\n```\n\n## convert-mock-import-to-require\n\nConvert [mockRequire](https://github.com/boblauer/mock-require) to [mockImport](https://github.com/coderaiser/mock-import).\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":1742069289707,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1742069289707,"dist-tags":{"latest":"21.20.0"}}