{"name":"@tapjs/before","version":"0.0.0-0","keywords":["tap","spy","fake"],"author":{"name":"Isaac Z. Schlueter"},"license":"BlueOak-1.0.0","_id":"@tapjs/before@0.0.0-0","maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/tapjs/tapjs/src/spawn#readme","bugs":{"url":"https://github.com/tapjs/tapjs/issues"},"dist":{"shasum":"c2fe7be83adb028c44e626de3c7f7ddadf98bf9b","tarball":"http://registry-npm.ywwl.com/@tapjs/before/download/@tapjs/before-0.0.0-0.tgz","fileCount":13,"integrity":"sha512-gvZf2VwIzHAkplAxtKLp6of0GnkQC10q/mcQiy/TtV05xrt/2LvKlih1rmvw0na/VeCoKI0+W+Dfq/sxo8TmhA==","signatures":[{"sig":"MEQCIGK6byXqKjkjBBKaqq3vakX6Kmx3z3Avht7R1McbV9IfAiA4klTu3LAfLzRjSiEETn6dDHYhnSn9Og/8ktqvRpJxMg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13071,"size":3279,"noattachment":false,"key":"/@tapjs/before/-/@tapjs/before-0.0.0-0.tgz"},"main":"./dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"./dist/mjs/index.js","engines":{"node":"^14.17.0 || ^16.13.0 || >=18.0.0"},"exports":{".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"gitHead":"3b13a7a2d4aeeef3dc05adffe29e0c8649208bad","scripts":{"snap":"tap","test":"tap","format":"prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache","prepare":"tsc -p tsconfig/cjs.json && tsc -p tsconfig/esm.json && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc --tsconfig tsconfig/esm.json ./src/*.ts"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"repository":{"url":"git+https://github.com/tapjs/tapjs.git","type":"git"},"_npmVersion":"9.8.1","description":"a built-in tap extension for t.before()","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"peerDependencies":{"@tapjs/core":"0.0.0-0"},"_npmOperationalInternal":{"tmp":"tmp/before_0.0.0-0_1691166941562_0.4343980569782524","host":"s3://npm-registry-packages"},"readme":"# `@tapjs/before`\n\nA default tap plugin providing `t.before()`.\n\n## USAGE\n\nThis plugin is installed with tap by default. If you had\npreviously removed it, you can `tap plugin add @tapjs/before` to\nbring it back.\n\n```ts\nimport t from 'tap'\nt.before(() => {\n  // this will run before the tests in this file start\n})\n```\n\nIf the method returns a promise, it will be awaited before moving\non to the next test.\n\nA `t.before()` method will run prior to any _subsequent_ child\ntests. If it's called before any child tests have started, then\nit will be run right away.\n\nSo, this test:\n\n```js\nimport t from 'tap'\n\nt.before(() => {\n  console.error('before initial')\n})\n\nt.test('first test', t => {\n  t.before(async () => {\n    // this will wait before moving on\n    await new Promise(res => setTimeout(res, 100))\n    console.error('before in first test')\n  })\n  console.error('in first test')\n  t.test('child test', t => {\n    console.error('child of first test')\n    t.end()\n  })\n  t.end()\n})\n\nt.before(() => {\n  console.error('before between')\n})\n\nt.test('second test', t => {\n  console.error('in second test')\n  t.end()\n})\n```\n\nwill print:\n\n```\nbefore initial\nin first test\nbefore in first test\nchild of first test\nbefore between\nin second test\n```\n\nEssentially, `t.before()` is a bit like a child test method that\ndoesn't get a `Test` object as an argument.\n","publish_time":1691166941671,"_cnpm_publish_time":1691166941671,"dist-tags":{"latest":"4.3.13","pre":"1.0.0"}}