{"id":18400913,"url":"https://github.com/magicmark/jest_question","last_synced_at":"2025-04-12T16:59:25.698Z","repository":{"id":69482044,"uuid":"155481757","full_name":"magicmark/jest_question","owner":"magicmark","description":"repro for a jest question","archived":false,"fork":false,"pushed_at":"2018-10-31T02:15:56.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T03:24:47.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicmark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-31T01:45:56.000Z","updated_at":"2018-10-31T02:15:58.000Z","dependencies_parsed_at":"2023-03-15T22:00:58.168Z","dependency_job_id":null,"html_url":"https://github.com/magicmark/jest_question","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicmark%2Fjest_question","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicmark%2Fjest_question/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicmark%2Fjest_question/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicmark%2Fjest_question/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicmark","download_url":"https://codeload.github.com/magicmark/jest_question/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602233,"owners_count":21131613,"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":[],"created_at":"2024-11-06T02:37:14.983Z","updated_at":"2025-04-12T16:59:25.674Z","avatar_url":"https://github.com/magicmark.png","language":"JavaScript","readme":"# Jest Question\n\nHow do we mock out stuff in integration tests _per test_ with jest?\n\nQuestion on Stack Overflow: https://stackoverflow.com/questions/53075279/how-do-we-mock-out-dependencies-with-jest-per-test\n\n## Repro\n\n```\n$ yarn test\n```\n\n### Current output\n\n```\n╔═ markl@dev21-uswest1cdevc: ~/jest_question git:(master)\n╚═ ♪ yarn test --no-watchman\nyarn run v1.10.1\n$ jest --no-watchman\n FAIL  __tests__/meal_test.js\n  meal tests\n    ✓ should print dinner (4ms)\n    ✕ should print breakfast (mocked) (21ms)\n\n  ● meal tests › should print breakfast (mocked)\n\n    expect(received).toBe(expected) // Object.is equality\n\n    Expected: \"Good morning. Breakfast is avocado and toast. Yum!\"\n    Received: \"Good evening. Dinner is green beans and rice. Yum!\"\n\n      23 |\n      24 |     // ...but we didn't mock it in time, so this fails!\n    \u003e 25 |     expect(getMeal()).toBe(\"Good morning. Breakfast is avocado and toast. Yum!\");\n         |                       ^\n      26 |   });\n      27 | });\n      28 |\n\n      at Object.toBe (__tests__/meal_test.js:25:23)\n\n  console.log __tests__/meal_test.js:22\n    { type: 'breakfast', veg: 'avocado', carbs: 'toast' }\n\nTest Suites: 1 failed, 1 total\nTests:       1 failed, 1 passed, 2 total\nSnapshots:   0 total\nTime:        1.149s\nRan all test suites.\nerror Command failed with exit code 1.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicmark%2Fjest_question","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicmark%2Fjest_question","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicmark%2Fjest_question/lists"}