{"id":13658158,"url":"https://github.com/jamiebuilds/fixturez","last_synced_at":"2025-03-15T13:31:16.860Z","repository":{"id":50309090,"uuid":"115983191","full_name":"jamiebuilds/fixturez","owner":"jamiebuilds","description":"Easily create and maintain test fixtures in the file system","archived":false,"fork":false,"pushed_at":"2024-01-09T13:59:43.000Z","size":104,"stargazers_count":56,"open_issues_count":8,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T21:02:42.953Z","etag":null,"topics":["ava","fixtures","jest","mocha","test"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamiebuilds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-02T06:36:44.000Z","updated_at":"2023-09-08T17:34:37.000Z","dependencies_parsed_at":"2024-06-18T17:10:41.389Z","dependency_job_id":"a7cd31ca-36ad-4f9e-bd87-e0670afd0f9d","html_url":"https://github.com/jamiebuilds/fixturez","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"d67fabd95d0c3b077633022ab7176ceed95f122f"},"previous_names":["thejameskyle/fixturez"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Ffixturez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Ffixturez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Ffixturez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Ffixturez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamiebuilds","download_url":"https://codeload.github.com/jamiebuilds/fixturez/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243735845,"owners_count":20339537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ava","fixtures","jest","mocha","test"],"created_at":"2024-08-02T05:00:56.885Z","updated_at":"2025-03-15T13:31:16.513Z","avatar_url":"https://github.com/jamiebuilds.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# fixturez\n\n\u003e Easily create and maintain test fixtures in the file system\n\n- Place fixtures in any parent directory\n- Find them again in your tests by their name\n- Searches up the file system to find a match\n- Makes it easy to move fixtures around and share between tests\n- Copy them into a temporary directory\n- Automatically cleanup any temporary files created\n\n## Install\n\n```sh\nyarn add --dev fixturez\n```\n\n## Example\n\n```\n/path/to/project/\n  /src/\n    /fixtures/\n      samples.txt\n      examples/...\n    /nested/\n      /fixtures/\n        data.json\n      test.js\n```\n\n```js\n// src/nested/test.js\nconst test = require('ava');\nconst fixtures = require('fixturez');\nconst f = fixtures(__dirname);\n\ntest('finding a fixture', t =\u003e {\n  let filePath = f.find('samples.txt'); // \"/path/to/project/src/fixtures/samples.txt\"\n  // ...\n});\n\ntest('copying a file', t =\u003e {\n  let tmpPath = f.copy('data.json'); //\n  // \"/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018/data.json\"\n  // (from /path/to/project/src/nested/fixtures/samples.txt)\n});\n\ntest('copying a directory', t =\u003e {\n  let tmpPath = f.copy('examples');\n  // \"/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd/examples\"\n  // (from /path/to/project/src/fixtures/examples)\n});\n```\n\n## API\n\n```js\nconst fixtures = require('fixturez');\n```\n\n### `fixtures(dirname, opts)`\n\nCreate fixture functions for the current file.\n\n```js\nconst f = fixtures(__dirname);\n```\n\n### `f.find(basename)`\n\nFind and return the path to a fixture by its `basename` (directory or filename\nincluding file extension).\n\n```js\nlet dirname = f.find('directory');\nlet filename = f.find('file.txt');\nf.find('file'); // Error, not found!\n```\n\n### `f.copy(basename)`\n\nCopy a fixture into a temporary directory by its `basename`.\n\n```js\nlet tempDir = f.copy('directory');\nlet tempFile = f.copy('file.txt');\n```\n\n### `f.temp()`\n\nCreate an empty temporary directory.\n\n```js\nlet tempDir = f.temp();\n```\n\n### `f.cleanup()`\n\nDeletes any temporary files you created. This will automatically be called when\nthe Node process closes.\n\n### `opts.glob`\n\nWhich files to match against when searching up the file system.\n\nDefault: `{fixtures,__fixtures__}/*`\n\n```js\nconst f = fixtures(__dirname, { glob: 'mocks/*.json' });\n```\n\n### `opts.cleanup`\n\nAutomatically cleanup temporary files created\n\nDefault: `true`\n\n```js\nconst f = fixtures(__dirname, { cleanup: false });\n```\n\n### `opts.root`\n\nSet the parent directory to stop searching for fixtures.\n\nDefault: `\"/\"`\n\n```js\nconst f = fixtures(__dirname, { root: 'path/to/project' });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiebuilds%2Ffixturez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamiebuilds%2Ffixturez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiebuilds%2Ffixturez/lists"}