{"name":"@tapjs/fixture","version":"4.1.0","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.1.0","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":"c9a2e3c805d962f69b6d026d51ccd6aa247e1667","tarball":"http://registry-npm.ywwl.com/@tapjs/fixture/download/@tapjs/fixture-4.1.0.tgz","fileCount":21,"integrity":"sha512-N3/N5Xxb6XVFbhxZ2URzCekZRxxebnPEWcCl9rF9CcCoUnZCG6Wu2tHK6ztjqR0DA+sX2umtDr9uT9eFVp2Upw==","signatures":[{"sig":"MEUCIQCULVhNP3dt4VVpja5F/IiAnL0ma9YcrZjrPxGbSVLisAIgN5WR29CyTWZL23JvJtI5eL8RHwqjMAZcvumiwkAujZc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68054,"size":11881,"noattachment":false,"key":"/@tapjs/fixture/-/@tapjs/fixture-4.1.0.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":"a9f6886a08dd45bc6af5469189a17804eb7858b7","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.6.3","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.1.0"},"_npmOperationalInternal":{"tmp":"tmp/fixture_4.1.0_1764088551461_0.5121164234451447","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":1764088551641,"_cnpm_publish_time":1764088551641,"dist-tags":{"latest":"4.3.12","pre":"1.0.0"}}