{"id":25000181,"url":"https://github.com/thinkmill/jest-fixtures","last_synced_at":"2025-04-12T08:51:20.080Z","repository":{"id":57280344,"uuid":"102324388","full_name":"Thinkmill/jest-fixtures","owner":"Thinkmill","description":"Use file system fixtures in Jest","archived":false,"fork":false,"pushed_at":"2018-04-03T00:15:48.000Z","size":117,"stargazers_count":40,"open_issues_count":1,"forks_count":3,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-05T19:53:30.456Z","etag":null,"topics":["fixtures","jest","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/Thinkmill.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}},"created_at":"2017-09-04T06:03:50.000Z","updated_at":"2024-12-12T08:10:05.000Z","dependencies_parsed_at":"2022-09-19T17:03:09.602Z","dependency_job_id":null,"html_url":"https://github.com/Thinkmill/jest-fixtures","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinkmill%2Fjest-fixtures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinkmill%2Fjest-fixtures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinkmill%2Fjest-fixtures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thinkmill%2Fjest-fixtures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thinkmill","download_url":"https://codeload.github.com/Thinkmill/jest-fixtures/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543882,"owners_count":21121838,"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":["fixtures","jest","test"],"created_at":"2025-02-04T19:31:48.428Z","updated_at":"2025-04-12T08:51:20.051Z","avatar_url":"https://github.com/Thinkmill.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest-fixtures\n\n\u003e [WIP]\n\n## Installation\n\n```sh\nyarn add --dev jest-fixtures\n```\n\n## API\n\n##### `getFixturePath(cwd, ...fileParts)`\n\n```js\nimport {getFixturePath} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  let fixturePath = await getFixturePath(__dirname, 'fixture-name');\n  let fixtureFilePath = await getFixturePath(__dirname, 'fixture-name', 'file.txt');\n  // ...\n});\n```\n\n##### `getFixturePathSync(cwd, ...fileParts)`\n\n```js\nimport {getFixturePathSync} from 'jest-fixtures';\n\ntest('example', () =\u003e {\n  let fixturePath = getFixturePathSync(__dirname, 'fixture-name');\n  let fixtureFilePath = getFixturePathSync(__dirname, 'fixture-name', 'file.txt');\n  // ...\n});\n```\n\n##### `createTempDir()`\n\n```js\nimport {createTempDir} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  let tempDirPath = await createTempDir();\n  // ...\n});\n```\n\n##### `createTempDirSync()`\n\n```js\nimport {createTempDirSync} from 'jest-fixtures';\n\ntest('example', () =\u003e {\n  let tempDirPath = createTempDirSync();\n  // ...\n});\n```\n\n##### `copyDir()`\n\n```js\nimport {copyDir} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  await copyDir('/path/to/source/dir', '/path/to/dest/dir');\n  // ...\n});\n```\n\n##### `copyDirIntoTempDir()`\n\n```js\nimport {copyDirIntoTempDir} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  let tempDir = await copyDirIntoTempDir('/path/to/source/dir');\n  // ...\n});\n```\n\n##### `copyFixtureIntoTempDir()`\n\n```js\nimport {copyFixtureIntoTempDir} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  let tempDir = await copyFixtureIntoTempDir(__dirname, 'fixture-name');\n  // ...\n});\n```\n\n##### `cleanupTempDirs()`\n\nDeletes every temporary directory created by `jest-fixtures`. This is called\nautomatically when the Jest process exits.\n\n```js\nimport {createTempDir, cleanupTempDirs} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  await createTempDir();\n  await createTempDir();\n  cleanupTempDirs();\n});\n```\n\n\u003c!--\n\n##### `loadFixture(fixturePath)` _[unimplemented]_\n\n```js\nimport {getFixturePath, loadFixture} from 'jest-fixtures';\n\ntest('example', async () =\u003e {\n  let fixturePath = await getFixturePath(__dirname, 'foo');\n  let fixture = await loadFixture(fixturePath);\n  // ...\n});\n```\n\n##### `loadFixtureSync(fixturePath)` _[unimplemented]_\n\n```js\nimport {getFixturePathSync, loadFixtureSync} from 'jest-fixtures';\n\ntest('example', () =\u003e {\n  let fixturePath = getFixturePathSync(__dirname, 'foo');\n  let fixture = loadFixtureSync(fixturePath);\n  // ...\n});\n```\n\n##### `createFsMock()` _[unimplemented]_\n\n```js\n// __mocks__/fs.js\nimport {createFsMock} from 'jest-fixtures';\nmodule.exports = createFsMock();\n```\n\n##### `fsMock.__setFixture__(fixture)` _[unimplemented]_\n\n```js\n// __mocks__/fs.js\nimport {createFsMock} from 'jest-fixtures';\nmodule.exports = createFsMock();\n```\n\n```js\nimport {getFixturePath, loadFixture} from 'jest-fixtures';\nimport * as fs from 'fs';\n\njest.mock('fs');\n\ntest('example', async () =\u003e {\n  let fixturePath = await getFixturePath(__dirname, 'foo');\n  let fixture = await loadFixture(fixturePath);\n  fs.__setFixture__(fixture);\n  // ...\n});\n```\n\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkmill%2Fjest-fixtures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkmill%2Fjest-fixtures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkmill%2Fjest-fixtures/lists"}