{"name":"@tapjs/before","version":"4.3.12","description":"a built-in tap extension for t.before()","tshy":{"main":true,"exports":{"./package.json":"./package.json",".":"./src/index.ts"},"selfLink":false},"type":"module","main":"./dist/commonjs/index.js","module":"./dist/esm/index.js","types":"./dist/commonjs/index.d.ts","exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"scripts":{"prepare":"tshy","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","format":"prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache","typedoc":"typedoc --tsconfig tsconfig/esm.json ./src/*.ts"},"author":{"name":"Isaac Z. Schlueter"},"license":"BlueOak-1.0.0","dependencies":{"is-actual-promise":"^1.0.1"},"peerDependencies":{"@tapjs/core":"4.6.0"},"tap":{"typecheck":false},"repository":{"type":"git","url":"git+ssh://git@github.com/tapjs/tapjs.git","path":"src/before"},"homepage":"https://github.com/tapjs/tapjs/tree/main/src/before#readme","bugs":{"url":"https://github.com/tapjs/tapjs/issues"},"keywords":["tapjs plugin"],"engines":{"node":"20 || >=22"},"gitHead":"8ab84eb1daae6dedbfcf07b8e0bf2c2a965ad81f","_id":"@tapjs/before@4.3.12","_nodeVersion":"26.5.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-rQlklkB2Za1jyzghV3rF+cW08qZ0l3sH6kI1OZzoZt9qa+nS/tD3KUJPvHeNrtM0O9N/0/vqj56nBzkiPYv24g==","shasum":"8656eff3dca5e28cc2eae3a4dae609676f581208","tarball":"http://registry-npm.ywwl.com/@tapjs/before/download/@tapjs/before-4.3.12.tgz","fileCount":13,"unpackedSize":18478,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDh4PGp7Nyx0tu/PFaGRaiwOwrouXVVLln7QsK6Rmf7fAiAvD0r3Z0C6WvagyciBvsUmYyxMAbRjufSP5+X6Tp2jcA=="}],"size":4300,"noattachment":false,"key":"/@tapjs/before/-/@tapjs/before-4.3.12.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"isaacs","email":"i@izs.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/before_4.3.12_1788477705047_0.07807744762323221"},"_hasShrinkwrap":false,"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":1788477705184,"_cnpm_publish_time":1788477705184,"dist-tags":{"latest":"4.3.13","pre":"1.0.0"}}