{"id":15284324,"url":"https://github.com/rwojsznis/rspec-sanity","last_synced_at":"2026-04-09T21:42:58.515Z","repository":{"id":160799273,"uuid":"615657701","full_name":"rwojsznis/rspec-sanity","owner":"rwojsznis","description":"Auto-ticket flaky tests in your rspec test suite","archived":false,"fork":false,"pushed_at":"2024-05-06T06:04:37.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-10T22:03:27.304Z","etag":null,"topics":["flaky-tests","github","jira","rspec","ruby"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwojsznis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-03-18T09:46:45.000Z","updated_at":"2024-06-05T06:38:27.607Z","dependencies_parsed_at":"2024-06-05T06:55:23.405Z","dependency_job_id":null,"html_url":"https://github.com/rwojsznis/rspec-sanity","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwojsznis%2Frspec-sanity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwojsznis%2Frspec-sanity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwojsznis%2Frspec-sanity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwojsznis%2Frspec-sanity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwojsznis","download_url":"https://codeload.github.com/rwojsznis/rspec-sanity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245138240,"owners_count":20566897,"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":["flaky-tests","github","jira","rspec","ruby"],"created_at":"2024-09-30T14:53:34.050Z","updated_at":"2026-04-09T21:42:56.407Z","avatar_url":"https://github.com/rwojsznis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rspec-sanity\n\nFlaky tests reporter that wraps your `rspec` call designed for the CI systems. [See this repo for a fully-working example](https://github.com/rwojsznis/rspec-sanity-example/).\n\n### Motivation\n\nCreate an opinionated statically typed wrapper on top of `rspec` instead of creating ad-hoc spaghetti of shell scripts every time at every company that is dealing with a similar problem.\n\n### Status\n\nIn working state, battle tested on few projects - _gets the job done_. Supports Github Issues and JIRA (with strong assumptions about how flakies are reported).\n\n### How to use it?\n\n1. Drop binary from the [releases](https://github.com/rwojsznis/rspec-sanity/releases) section into your system's `PATH`\n1. Ensure you have configured Rspec's [example_status_persistence_file_path](https://rubydoc.info/gems/rspec-core/RSpec%2FCore%2FConfiguration:example_status_persistence_file_path)\n1. Create `.rspec-sanity.toml` configuration file (more details below)\n1. From the root project directory execute `rspec-sanity run [test files]` - in the exact same manner same as you would run `rspec [test files]`\n\nYour `[test files]` will be executed _up to two times_ - if something that failed passed on the 2nd attempt it means it's flaky and will be reported as a JIRA ticket/Github issue according to your configuration.\n\n#### Alternative installation method (Debian/Ubuntu)\n\nIf you prefer installing binary via `apt` you can use grab `deb` from [gemfury](https://gemfury.com/). Deb packages are generated as part of the release process so they will be always up to date with the Github releases.\n\n```\ncurl -fsSL https://apt.fury.io/rspec-sanity/gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/rspec-sanity.gpg \u003e /dev/null\necho \"deb [signed-by=/etc/apt/trusted.gpg.d/rspec-sanity.gpg] https://apt.fury.io/rspec-sanity/ * *\" | sudo tee /etc/apt/sources.list.d/rspec-sanity.list\nsudo apt-get update \u0026\u0026 sudo apt-get install rspec-sanity\n```\n\n### Configuration syntax\n\nBy default the app will try to look up `.rspec-sanity.toml` - which can be configured with `--config` switch.\n\n```toml\n# defined how to load rspec command\ncommand = \"bundle exec rspec\"\n\n# arguments that will be passed to your command on the first attempt\narguments = \"--format progress --format RspecJunitFormatter -o tmp/rspec/rspec.xml --force-color\"\n\n# arguments used for the 2nd attempt (re-run)\nrerun_arguments = \"--format documentation --force-color\"\n\n# file path defined for example_status_persistence_file_path in Rspec\npersistence_file = \"spec/examples.txt\"\n\n# Right now you can use github or jira reporters\n# only one will be picked up\n[github]\nowner = \"rwojsznis\"\nrepo = \"rspec-sanity\"\n# optional labels\nlabels = ['flaky-spec']\n\n# reopen GH issue if it was closed when adding new report?\nreopen = true\n\n# Under .Env you will find all available env variables on the system\n# Here I'm using some handy stuff defined by CircleCI\ntemplate = '''\nFailed build: {{ .Env.CIRCLE_BUILD_URL }}\nNode: {{ .Env.CIRCLE_NODE_INDEX }}\nBranch: {{ .Env.CIRCLE_BRANCH }}\n\n| Example |\n| --- |\n{{- range .Examples}}\n| {{ .Id }} |\n{{- end}}\n'''\n\n[jira]\n# There is a strong assumption that every JIRA ticket will be\n# reported to an epic issue\nepic_id = \"PROD-1\"\n# issue type, can vary from project to project\n# can be found in JIRA project settings\ntask_type_id = \"10001\"\n# ID of the JIRA project\nproject_id = \"PROD\"\n# optional labels\nlabels = ['flaky-spec']\ntemplate = '''\nFailed build: {{ .Env.CIRCLE_BUILD_URL }}\nNode: {{ .Env.CIRCLE_NODE_INDEX }}\nBranch: {{ .Env.CIRCLE_BRANCH }}\n\n| Example |\n{{- range .Examples}}\n| {{ .Id }} |\n{{- end}}\n'''\n```\n\n### Additional configuration per reporter\n\n#### Github\n\nTo authorize with Github you need to set `RSPEC_SANITY_GITHUB_TOKEN` ENV variable - [it can be a personal token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) or newly [introduced fine-grained token](https://github.blog/2022-10-18-introducing-fine-grained-personal-access-tokens-for-github/) - just make you have access to **write** issues.\n\n\n### JIRA\n\nTo authorize with JIRA you need to set following ENV variables:\n\n- `RSPEC_SANITY_JIRA_TOKEN` - JIRA [personal access token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html) - I recommend creating a dedicated JIRA user for this purposes\n- `RSPEC_SANITY_JIRA_USER` - email address of the token owner\n- `RSPEC_SANITY_JIRA_HOST` - full JIRA instance address, with a protocol (`https://`)\n\n#### Creating a test issue\n\nTo check your configuration you run `rspec-sanity verify`.\n\n### Todos / nice to haves\n\n- proper interfaces for better tests\n- Github-related tests [with go-github-mock](https://github.com/migueleliasweb/go-github-mock)\n- uploading artifacts associated with flaky tests (eg. screenshots captured with [capybara-screenshot](https://github.com/mattheworiordan/capybara-screenshot))\n- auto-generating `bisect` command for flaky test replication attempt (we would have to grab used rspec seed)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwojsznis%2Frspec-sanity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwojsznis%2Frspec-sanity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwojsznis%2Frspec-sanity/lists"}