{"id":16118222,"url":"https://github.com/zacharygolba/snaptest","last_synced_at":"2025-10-07T23:58:49.785Z","repository":{"id":57667818,"uuid":"125684769","full_name":"zacharygolba/snaptest","owner":"zacharygolba","description":"📸🔬 Dead simple snapshot testing","archived":false,"fork":false,"pushed_at":"2018-03-21T14:07:23.000Z","size":736,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-04T19:29:57.626Z","etag":null,"topics":["rust","snapshot","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zacharygolba.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-18T02:02:22.000Z","updated_at":"2022-08-23T13:39:12.000Z","dependencies_parsed_at":"2022-09-10T16:01:00.216Z","dependency_job_id":null,"html_url":"https://github.com/zacharygolba/snaptest","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zacharygolba/snaptest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharygolba%2Fsnaptest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharygolba%2Fsnaptest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharygolba%2Fsnaptest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharygolba%2Fsnaptest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacharygolba","download_url":"https://codeload.github.com/zacharygolba/snaptest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharygolba%2Fsnaptest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278866932,"owners_count":26059671,"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-10-07T02:00:06.786Z","response_time":59,"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":["rust","snapshot","testing"],"created_at":"2024-10-09T20:48:58.841Z","updated_at":"2025-10-07T23:58:49.741Z","avatar_url":"https://github.com/zacharygolba.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# snaptest\n\n[![CircleCI branch](https://img.shields.io/circleci/project/github/zacharygolba/snaptest/master.svg?style=flat-square)](https://circleci.com/gh/zacharygolba/snaptest/tree/master) [![AppVeyor branch](https://img.shields.io/appveyor/ci/zacharygolba/snaptest/master.svg?logo=appveyor\u0026style=flat-square)](https://ci.appveyor.com/project/zacharygolba/snaptest/branch/master) [![Crates.io](https://img.shields.io/crates/v/snaptest.svg?style=flat-square)](https://crates.io/crates/snaptest)\n\nDead simple snapshot testing (inspired by [jest](https://facebook.github.io/jest/)).\n\nDocumentation (including this README) is a work in progress. Feel free to submit an issue if you have a question about usage.\n\n## Features\n\n- Any type that implements [`Debug`](https://doc.rust-lang.org/std/fmt/trait.Debug.html) can be returned from a test.\n- First class integration with [`failure`](https://boats.gitlab.io/failure/).\n- The snapshot store is thread safe so your tests can run in parallel.\n- Beautiful diffs are printed when a snapshot test fails.\n- A single small binary file is used to store snapshots.\n\nTODO\n\n## Installation\n\nFirst, add `snaptest` to the dependencies section of your `Cargo.toml`:\n\n```toml\n[dependencies]\nsnaptest = \"0.1\"\n```\n\nNext, add the following snippet to the entry point of your crate (`lib.rs` or `main.rs`):\n\n```rust\n#[macro_use]\nextern crate snaptest;\n```\n\n## Usage\n\nDerive `Debug` on types that you want to use with snaptest:\n\n```rust\n#[macro_use]\nextern crate failure;\n#[cfg_attr(test, macro_use)]\nextern crate snaptest;\n\nuse std::str::FromStr;\n\n#[derive(Debug)]\nenum Hero {\n    Batman,\n    TheFlash,\n    WonderWoman,\n}\n\nimpl FromStr for Hero {\n    type Err = Error;\n\n    fn from_str(value: \u0026str) -\u003e Result\u003cHero, Self::Err\u003e {\n        match value {\n            \"Batman\" =\u003e Ok(Hero::Batman),\n            \"The Flash\" =\u003e Ok(Hero::TheFlash),\n            \"Wonder Woman\" =\u003e Ok(Hero::WonderWoman),\n            _ =\u003e bail!(r#\"\"{}\" is not a hero\"#),\n        }\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use failure::Error;\n\n    use super::Hero; // no pun intended...\n\n    snaptest!{\n        fn parse_heros() -\u003e Result\u003cVec\u003cHero\u003e, Error\u003e {\n            let heros = [\"Batman\", \"The Flash\", \"Wonder Woman\"];\n            heros.iter().map(|hero| hero.parse()).collect()\n        }\n    }\n}\n```\n\nNext time your test runs, a snapshot will be added to a local `.snapfile` to compare against future test results. If you get a different result back than what matches the snapshot, the test will fail and the diff will be printed to the console.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg  alt=\"Snaptest Example\" src=\"./docs/example.png\" width=\"818\" /\u003e\n\u003c/p\u003e\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0\n  ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license\n  ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacharygolba%2Fsnaptest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacharygolba%2Fsnaptest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacharygolba%2Fsnaptest/lists"}