{"name":"@tapjs/before","version":"0.0.0-22","keywords":["tapjs plugin"],"author":{"name":"Isaac Z. Schlueter"},"license":"BlueOak-1.0.0","_id":"@tapjs/before@0.0.0-22","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"},"tap":{"typecheck":false},"dist":{"shasum":"e5f6e1db94c128b7dd2a6efcd210f584b19f9c9f","tarball":"http://registry-npm.ywwl.com/@tapjs/before/download/@tapjs/before-0.0.0-22.tgz","fileCount":13,"integrity":"sha512-ePJT2QHOAdMgMBTtD9UzcebCttS5cErilb8r+ELWbx6rZeu+o5Ibbj1xXE92aIcQ2Pp6l6qG0zk/zu857WeZ1g==","signatures":[{"sig":"MEUCIAFfNLkJN67S1Eg7sWbpBbnh9Fbsg36197AuS+M0QQELAiEA+tIG3/R2UtWQu7dFKO1RdhQvxgudnYxj8vy+JsJ7nI8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18174,"size":4259,"noattachment":false,"key":"/@tapjs/before/-/@tapjs/before-0.0.0-22.tgz"},"tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","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","engines":{"node":">=16"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"82f48cd053bb57d17a5146b4e385d588f05d1a22","scripts":{"snap":"tap","test":"tap","format":"prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache","prepare":"tshy","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","dependencies":{"is-actual-promise":"^1.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"@tapjs/core":"0.0.0-22"},"_npmOperationalInternal":{"tmp":"tmp/before_0.0.0-22_1694624555300_0.2881474939803528","host":"s3://npm-registry-packages"},"publish_time":1694624555445,"_cnpm_publish_time":1694624555445,"dist-tags":{"latest":"4.3.13","pre":"1.0.0"}}