{"name":"test-fixture","version":"2.4.1","description":"Copy test-fixtures to temp dir and get resolved file paths.","main":"index.js","scripts":{"test":"nyc ava --timeout=10s --verbose","test:dev":"nyc ava --timeout=10s --verbose && npm run report:dev","lint":"eslint .","fix":"eslint . --fix","posttest":"npm run report","report":"nyc report --reporter=text-lcov > coverage.lcov && codecov","report:dev":"nyc report --reporter=html && npm run report:open","report:open":"open coverage/index.html"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-test-fixture.git"},"keywords":["test","fixtures","resolve","copy","temp","tmp"],"engines":{"node":">= 7"},"ava":{"babel":false,"files":["test/*.test.js"]},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-test-fixture/issues"},"devDependencies":{"@ostai/eslint-config":"^3.1.1","ava":"^1.4.1","codecov":"^3.4.0","eslint":"^5.16.0","eslint-plugin-import":"^2.17.2","nyc":"^14.1.1"},"dependencies":{"core-util-is":"^1.0.2","fs-extra":"^7.0.1","npminstall":"^4.0.0","tmp-promise":"^1.1.0"},"gitHead":"dd8b78f8a5cd3a7af23d5f5fcd1a0de01574b140","homepage":"https://github.com/kaelzhang/node-test-fixture#readme","_id":"test-fixture@2.4.1","_nodeVersion":"12.6.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-eRFd+6HnCTK3E7Wam8nO4qxqbEG6837EEEbcl3tARxwmcK2OOyvyc4CbZmc59cLQ4Lxa/G57AZvKi+cSpyOPpw==","shasum":"a1f75b2db84da69f4dca14262ed222f86c6a1a69","tarball":"http://registry-npm.ywwl.com/test-fixture/download/test-fixture-2.4.1.tgz","fileCount":4,"unpackedSize":7182,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdV2zqCRA9TVsSAnZWagAA1U8P/Rls/suIEcBR8vWGV/na\ngjXDLfNRH3N6g8v9KYTwPv1izB12eEj7/QJc2wxxOs5xNyW4uWY0gQmZPsSx\nXfi4N954+WTgEXDWJd9Hbl6gvguNN3ZkCkYZ9nRQP7Xv/JCpW1zw47J7a/pc\n6ROOzL1Y8aThUkJw/W9ZgZDCOrcHEPhV/z6hXhDeR1fMiouLLh4YhuAuX7TJ\nIQzK3H358cX4efaH88Ws+nNAUsHRAfgWUB4udz4arBG9j1abaGnDJONTFaiw\n/QzNEbmKCwPBJER+Hq0FqoGw1SMWeRCgybbRep0SGFh7aSMDsBamCAuClzKL\ncXnwkrZ1DfifDq2AWo3Ro9ZX/VcM5e6mBqSFcct2zatdikcEh4jaj7xSLcZ+\niS91dEqqkoC6WdUETN0tB/KdApM0zQ+tvv7D/gyRbns2zUL+Ks33jVNltHjc\n/c6R/Ppd1/N8Y/O0icqrY5ibSZLmYndB4ewHiW2/I262cHgf34TwYa7XP1MD\nY0aV8Np7MeQ4LCPhJZ9N+4/BAH8Wzs0QkMvkSCy1JWIZ7Hs9NwAA7m+bfiNG\ncnzbQQ9QKDint7AB9HB6xC48Un0R3JWZS8KJBGAEqLvKBZNND3sObX/4tqbf\njzFEPb5Yw2H2cLnwZi6Ebd8MgHBo6FJE0QOcMSdrIhdzw3Z9eYJqrbcRvP6+\nPJuH\r\n=XWts\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG3L8QAdL4x0q07Fyo6WDZy9c4CybzHmKdqW+Px4MfO0AiEA7yQtXrfIDKg7jxLU2ROcqH7fE03LGN5BhNX7jhsSMXc="}],"size":3109,"noattachment":false,"key":"/test-fixture/-/test-fixture-2.4.1.tgz"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"_npmUser":{"name":"kael","email":"i@kael.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/test-fixture_2.4.1_1566010601443_0.7714078040875201"},"_hasShrinkwrap":false,"readme":"[![Build Status](https://travis-ci.org/kaelzhang/node-test-fixture.svg?branch=master)](https://travis-ci.org/kaelzhang/node-test-fixture)\n[![Coverage](https://codecov.io/gh/kaelzhang/node-test-fixture/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/node-test-fixture)\n\n# test-fixture\n\nCopy test fixtures to a temp dir and get resolved file paths.\n\n### Why?\n\nI am tired of writing these:\n\n```js\npath.resolve(__dirname, 'test', 'fixtures')\ntmp.dir(callback)\nfse.copy(fixtures, dir)\npath.join(fixtures, 'some-file.js')\n```\n\n**EVERY DAY!**\n\nSo, I got this.\n\n## Install\n\n```bash\n$ npm i test-fixture -D\n```\n\n## Usage\n\n```js\n// By default, it will use 'test/fixtures' dir.\nconst {copy, resolve} = require('test-fixture')()\n\n// copy 'test/fixtures' to the temp dir\n;(async () => {\n  await copy()\n  console.log(resolve('foo.js'))\n  // '/<temp-dir>/foo.js'\n})\n```\n\n### fixtures(...paths): {resolve, copy, install, root}\n\n- **paths** `Array<path>` to define the root paths of the fixtures, which is similar as\n\nDefines the root of the fixture\n\n```js\nconst path = require('path')\nconst fixturesRoot = path.resolve(projectRoot, 'test', 'fixtures')\n\npath.resolve(fixturesRoot, ...paths)\n```\n\n`...paths` | `base`(dir of test fixtures)\n--------- | --------------------\n`undefined` | `test/fixtures`\n`'a'` | `test/fixtures/a`\n`'a'`, `'b'` | `test/fixtures/a/b`\n`'/path/to'` (absolute) | `/path/to`\n`'/path/to'` (absolute), `'a'` | `/path/to/a`\n\nActually, the `base` is `path.resolve('text/fixtures', ...paths)`\n\n#### Without copying\n\n```js\nconst {resolve} = fixtures(p)\nresolve('a.js')  // -> /path/to/<p>/a.js\n```\n\n#### Using `.copy()`\n\n```js\nconst {copy, resolve} = fixtures(p)\n\nawait copy('/path/to')\n\nresolve('a.js') // -> /path/to/a.js\n```\n\n### await copy(options?)\n### await copy(to?)\n\n- **options?** `Object`\n  - **to?** `path=` the destination folder where the test fixtures will be copied to. If not specified, a temporary directory will be used.\n  - **clean?** `boolean=false` whether should clean the directory `to` if `options.to` is specified.\n  - **install?** `boolean=false` whether should run npm install after copying\n\nCopy the test fixtures into another directory.\n\n```js\ncopy('/path/to')\n\n// is equivalent to\ncopy({\n  to: '/path/to',\n  install: false\n})\n```\n\n### resolve(...paths)\n\nResolves the paths to get the path of the test fixtures\n\nAfter `.copy()`ed, it will resolve paths based on the destination dir.\n\nIf not, it will use the base dir. But never use both of them simultaneously.\n\n```\n/path/to/<base>\n             |-- a.js\n/path/to/<to>\n           |-- a.js\n```\n\n### await install(options?)\n\n- **options?** `Object` options of [`npminstall`](https://npmjs.org/package/npminstall)\n\nInstall packages in the working directory. If run after `await copy()`, then it will install packages in the directory which fixtures copied to.\n\n### getter: root `string`\n\nThe fixture root `/<project-root>/test/fixtures`\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1566010601556,"_cnpm_publish_time":1566010601556,"dist-tags":{"latest":"2.4.1"}}