{"name":"@tapjs/fixture","version":"4.0.7","keywords":["tapjs plugin"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"@tapjs/fixture@4.0.7","maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/tapjs/tapjs#readme","bugs":{"url":"https://github.com/tapjs/tapjs/issues"},"tap":{"typecheck":false,"coverage-map":"map.js"},"dist":{"shasum":"cc1f26ad821fd5a856c9c2659c7e7c2a32721223","tarball":"http://registry-npm.ywwl.com/@tapjs/fixture/download/@tapjs/fixture-4.0.7.tgz","fileCount":21,"integrity":"sha512-GJFZdHjdaTwe08p3BkCZoRQ9aSqiUQbvho4F0YGCDQJRiZwRLN5lp6bxrCjvngkYl+nrIXudTLHM7/sEpQR5Hw==","signatures":[{"sig":"MEYCIQC1IbdVyFxfMq2ENe+6WWid7w2RGMZkKeLaUpnROor48QIhAIhkOggRYOn3PLvbXhSJPzRUiZppKPDVZiY4Th0Sqg1M","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67904,"size":11845,"noattachment":false,"key":"/@tapjs/fixture/-/@tapjs/fixture-4.0.7.tgz"},"main":"./dist/commonjs/index.js","tshy":{"main":true,"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":"20 || >=22"},"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"},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"ea6ee79909d4a0ca93aef1172c37c32e20a0102a","scripts":{"snap":"tap","test":"tap","format":"prettier --write . --log-level 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":"11.6.2","description":"Tap plugin to provide t.testdir() and t.fixture()","directories":{},"_nodeVersion":"24.4.1","dependencies":{"mkdirp":"^3.0.0","rimraf":"^6.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"@tapjs/core":"4.0.7"},"_npmOperationalInternal":{"tmp":"tmp/fixture_4.0.7_1763860012617_0.14980450165122106","host":"s3://npm-registry-packages-npm-production"},"readme":"# `@tapjs/fixture`\n\nA default tap plugin providing `t.testdir()` and `t.fixture()`\nmethods, for creating temporary directories with stuff for tests\nto operate on.\n\nFixtures created with this plugin live folders under\n`./.tap/fixtures`, in the root of the project. The folder name is\nbased on the name of the test file, and the name of the test.\n\nFor example, if a file at `./src/foo.test.mjs` had this:\n\n```js\nimport t from 'tap'\nt.test('child test', async t => {\n  t.testdir({ file: 'contents' })\n})\n```\n\nThen a file would be created at\n`.tap/fixtures/src-foo.test.mjs-child-test/file` containing\n`'contents'`.\n\n## USAGE\n\nThis plugin is installed with tap by default. If you had\npreviously removed it, you can `tap plugin add @tapjs/fixture` to\nbring it back.\n\n### `t.testdir(contents?: FixtureDirContent): string`\n\nCreate a directory with some stuff in it.\n\nIf no contents provided, just creates an empty directory.\n\n```ts\nimport t from 'tap'\nimport { lstatSync } from 'node:fs'\n\nt.test('subtest that has a test directory', t => {\n  const dir = t.testdir({\n    // objects are subdirectories\n    subdir: {\n      // strings or buffers are files\n      'file.txt': 'some contents',\n      // to create links or symlinks, use the t.fixture() method\n      symlink: t.fixture('symlink', 'file.txt'),\n      hardlink: t.fixture('link', 'file.txt'),\n    },\n  })\n  t.equal(lstatSync(dir + '/subdir/symlink').isSymbolicLink(), true)\n  t.end()\n})\n// dir removed when test ends\n```\n\nIf you do not provide a contents argument, then it will create an\nempty directory.\n\nThough it's called `t.testdir()` you can actually use it to\ncreate files or links as well.\n\n```ts\nimport t from 'tap'\nimport { readFileSync } from 'node:fs'\nt.test('test \"dir\" is actually file', t => {\n  const file = t.testdir('file contents')\n  t.equal(readFileSync(file, 'utf8'), 'file contents')\n  t.end()\n})\n```\n\n### `t.testdirName: string`\n\nThis is a string that gives you the string path that\n`t.testdir()` will write to.\n\n### `saveFixture` test option, `t.saveFixture: boolean`\n\nIf set to `true`, then the test will not delete its fixtures when\nit finishes.\n\nIf set on the test object, this must be set _before_ calling\n`t.testdir()`, or it won't have any effect, since the deletion is\nscheduled at the moment it's created.\n","publish_time":1763860012805,"_cnpm_publish_time":1763860012805,"dist-tags":{"latest":"4.3.12","pre":"1.0.0"}}