{"id":16442552,"url":"https://github.com/smeijer/where-broke","last_synced_at":"2025-07-22T18:33:39.846Z","repository":{"id":53219686,"uuid":"276974062","full_name":"smeijer/where-broke","owner":"smeijer","description":"A CLI utility that helps finding breaking module versions using binary search and automated tests.","archived":false,"fork":false,"pushed_at":"2023-05-27T12:22:46.000Z","size":1267,"stargazers_count":92,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-26T00:39:48.923Z","etag":null,"topics":["analysis","cli","nodejs","testing"],"latest_commit_sha":null,"homepage":"","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/smeijer.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":"2020-07-03T19:32:30.000Z","updated_at":"2023-05-27T12:22:22.000Z","dependencies_parsed_at":"2022-09-07T21:02:29.227Z","dependency_job_id":null,"html_url":"https://github.com/smeijer/where-broke","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/smeijer/where-broke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeijer%2Fwhere-broke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeijer%2Fwhere-broke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeijer%2Fwhere-broke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeijer%2Fwhere-broke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smeijer","download_url":"https://codeload.github.com/smeijer/where-broke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smeijer%2Fwhere-broke/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552467,"owners_count":23947174,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analysis","cli","nodejs","testing"],"created_at":"2024-10-11T09:17:51.013Z","updated_at":"2025-07-22T18:33:39.818Z","avatar_url":"https://github.com/smeijer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# where-broke\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n**Find the version of a lib that broke your tests**\n\n![animation of where-broke results](./docs/where-broke.gif)\n\nMost often when there is a regression in a lib that we use, we want to know what the last working version was. This project helps you find that version!\n\n## Usage\n\nRun the following command in the root of the the project that contains the breaking test (next to `package.json`). Replace `{lib}` with the module name that you wish to bisect.\n\n```shell\nnpx where-broke {lib}\n```\n\n## Requirements\n\nTo make this work, the project should match the following requirements:\n\n- there should be a `package.json` in the project root\n- there should be a `test` script defined in `package.json`\n- `npm run test` returns a non-zero exit code in case of failure\n- `npm run test` returns a zero exit code in case of success\n\n## Example\n\nFor example, at a certain moment, `@testing-library/dom` contained a breaking change that made `getByRole('form')` fail when the `form` element didn't have an explicit `role` defined. To trace this breaking change down, the first thing we need to do is create a reproduction.\n\nFor this specific case, the following test would throw on their latest version:\n\n```js\nimport { getQueriesForElement } from '@testing-library/dom';\n\nfunction render(html) {\n  const container = document.createElement('div');\n  container.innerHTML = html;\n\n  return getQueriesForElement(container);\n}\n\ntest('finds form without role', () =\u003e {\n  const { getByRole } = render('\u003cform /\u003e');\n  getByRole('form');\n});\n```\n\nTo test this, we would make sure that this script is triggered when running `npm run test`. I used the `test` method from `jest`, but any test script that returns a non-zero exit code on fail, works.\n\nNow, instead of `npm run test`, we run:\n\n```shell\nnpx where-broke @testing-library/dom\n```\n\nThis will take some time, as it will run until it finds the breaking version.\n\nBut no worries, we're not going to test them all. We use a \"binary search\" to speed up the process. Basically, we'll cut the apple in halves, until we find the rotten part.\n\n```shell\n~/dev/dom-issue\n➜ npx where-broke @testing-library/dom\nnpx: installed 37 in 2.088s\n\nCheck for regression in @testing-library/dom\n\nℹ Found 111 versions, will need to test 7 of them\n\n✖ @testing-library/dom@7.0.2\n✔ @testing-library/dom@6.4.0\n✔ @testing-library/dom@6.12.0\n✖ @testing-library/dom@6.16.0\n✔ @testing-library/dom@6.14.0\n✖ @testing-library/dom@6.15.0\n✖ @testing-library/dom@6.14.1\n\n  The tests passed in 6.14.0 and fail since 6.14.1\n```\n\nNow we know, that the breaking change was introduced in `6.14.1`. The last version that we can use is `6.14.0`, and we can tell the project maintainers that they should look for the cause between `6.14.0` and `6.14.1`;\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/smeijer\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/1196524?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eStephan Meijer\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-smeijer\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/smeijer/where-broke/commits?author=smeijer\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#infra-smeijer\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"#maintenance-smeijer\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://michaeldeboey.be\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/6643991?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMichaël De Boey\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/smeijer/where-broke/commits?author=MichaelDeBoey\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-MichaelDeBoey\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://nickmccurdy.com/\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/927220?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNick McCurdy\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-nickmccurdy\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://iansutherland.ca/\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/433725?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIan Sutherland\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/smeijer/where-broke/commits?author=iansu\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmeijer%2Fwhere-broke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmeijer%2Fwhere-broke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmeijer%2Fwhere-broke/lists"}