{"name":"@tapjs/fixture","version":"4.3.6","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.3.6","maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/tapjs/tapjs/src/fixture#readme","bugs":{"url":"https://github.com/tapjs/tapjs/issues"},"tap":{"typecheck":false,"coverage-map":"map.js"},"dist":{"shasum":"c005eb2827b78771f16a85c7256839fb06c9f925","tarball":"http://registry-npm.ywwl.com/@tapjs/fixture/download/@tapjs/fixture-4.3.6.tgz","fileCount":21,"integrity":"sha512-s04kqxqcDLVPnjJgmZIPHX0kTHff7PmwbNxVMVewods41jSvpelge6ekrVLl0J4NOLtLiIiAixVzE+acVQx7Fw==","signatures":[{"sig":"MEUCIQCx4lvyJ0EJe6oLWXYRc8I2gDvdrf0bZTSoS5KkdJc4dwIgQZebKFhA8kcU+VA6OpH1stiQZVL4FZoP0mYtiVvj4aQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68091,"size":11901,"noattachment":false,"key":"/@tapjs/fixture/-/@tapjs/fixture-4.3.6.tgz"},"main":"./dist/commonjs/index.js","tshy":{"main":true,"exports":{".":"./src/index.ts","./package.json":"./package.json"},"selfLink":false},"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":"5a7a801b417ca1a3bf19fd097f48ef864a6e7792","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+ssh://git@github.com/tapjs/tapjs.git","path":"src/fixture","type":"git"},"_npmVersion":"11.11.1","description":"Tap plugin to provide t.testdir() and t.fixture()","directories":{},"_nodeVersion":"25.8.2","dependencies":{"mkdirp":"^3.0.0","rimraf":"^6.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"@tapjs/core":"4.5.4"},"_npmOperationalInternal":{"tmp":"tmp/fixture_4.3.6_1776246243179_0.02577774697795765","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":1776246243346,"_cnpm_publish_time":1776246243346,"dist-tags":{"latest":"4.3.12","pre":"1.0.0"}}