{"id":15685176,"url":"https://github.com/gregnavis/minitest-fork_executor","last_synced_at":"2025-09-03T03:40:51.977Z","repository":{"id":56883902,"uuid":"164108668","full_name":"gregnavis/minitest-fork_executor","owner":"gregnavis","description":"Near-perfect process-level test case isolation.","archived":false,"fork":false,"pushed_at":"2021-11-09T22:12:12.000Z","size":18,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-13T02:36:39.354Z","etag":null,"topics":["isolation","minitest","testing"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/gregnavis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-04T13:07:12.000Z","updated_at":"2024-01-17T21:01:44.000Z","dependencies_parsed_at":"2022-08-20T13:10:41.599Z","dependency_job_id":null,"html_url":"https://github.com/gregnavis/minitest-fork_executor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gregnavis/minitest-fork_executor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregnavis%2Fminitest-fork_executor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregnavis%2Fminitest-fork_executor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregnavis%2Fminitest-fork_executor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregnavis%2Fminitest-fork_executor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregnavis","download_url":"https://codeload.github.com/gregnavis/minitest-fork_executor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregnavis%2Fminitest-fork_executor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273386696,"owners_count":25096247,"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-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["isolation","minitest","testing"],"created_at":"2024-10-03T17:24:08.931Z","updated_at":"2025-09-03T03:40:51.957Z","avatar_url":"https://github.com/gregnavis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minitest Fork Executor\n\n`minitest-fork_executor` helps you avoid leaking state between individual\n`test_*` methods and `*Test` classes by running each test method in a separate\nprocess.\n\n[![Build Status](https://github.com/gregnavis/minitest-fork_executor/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/gregnavis/minitest-fork_executor/actions/workflows/test.yml)\n\n## Installation\n\nInstall via Ruby Gems:\n\n```\ngem install minitest-fork_executor\n```\n\nor add to `Gemfile`:\n\n```ruby\ngem 'minitest-fork_executor', group: :test\n```\n\nThen configure Minitest to use it by adding the following to `test_helper.rb`\nor a similar file:\n\n```ruby\nMinitest.parallel_executor = Minitest::ForkExecutor.new\n```\n\nThats it! From now on, each test method will be run in a separate process.\n\n## Caveat\n\nWhen `minitest-fork_executor` some exceptions raised during test case execution\nmay be reported as a different exception class. This is by design and was\nrequired to overcome limitations imposed by certain implementation choices.\n\n`minitest-fork_executor` run each test method in a separate process. The\nresult, including number of assertions and exceptions (if any) raised during\nexecution, must be passed to the parent process for reporting. We use `Marshal`\nto communicate between processes using a pipe object.\n\nProblems araise when the test method raises an exception that references an\nobject unsupported by `Marshal`. For example, a database exception may contain\na reference to the database connection socket, which cannot be marshalled. To\novercome that limitation, we convert non-marshallable exceptions into a\ndifferent class, called `Minitest::ForkExecutor::UnmarshallableError` that is\nguaranteed to be marshallable and which tries to retain as much original\ninformation as possible.\n\n## Rationale\n\nThe idea for for a new forker came when I was working on [`active_record_doctor`](https://github.com/gregnavis/active_record_doctor).\nI had just set up a test suite against multiple versions of Ruby and Rails but\ncouldn't get rid of random test case failures. Further troubleshooting indicated\nthe problem lied in insufficient garbage collection, most likely caused by a bug\ndeep in the guts of Active Support. Resolving the problem for a specific\nRuby/Rails version combination would make the problem appear in different\nversions.\n\nSubmitting a patch to Active Support wouldn't be a complete solution because\nRails 4.2, which I wanted to support, had already reached end-of-life. That,\nplus my limited time budget for open source work made `minitest-fork_executor`\nan economical idea.\n\n## Prior Art\n\n`minitest-parallel_fork` is a similar gem but works at a class-level instead of\ntest-case level. It means `test_*` methods defined on the same test class can\nstill leak state. The problem could be avoided by splitting each test class\ninto multiple single-method test classes (one for each `test_*` method) however\nI decided against that solution in order to maintain higher test class cohesion.\n\n## Author\n\nThis gem is developed and maintained by [Greg Navis](mailto:contact@gregnavis.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregnavis%2Fminitest-fork_executor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregnavis%2Fminitest-fork_executor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregnavis%2Fminitest-fork_executor/lists"}