{"id":18047144,"url":"https://github.com/jw3126/snaptests.jl","last_synced_at":"2025-07-25T01:17:06.261Z","repository":{"id":172322602,"uuid":"649139496","full_name":"jw3126/SnapTests.jl","owner":"jw3126","description":"Minimalistic snapshot tests ","archived":false,"fork":false,"pushed_at":"2024-05-06T07:59:09.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-05T18:23:45.624Z","etag":null,"topics":["julia","snapshot","test"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/jw3126.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-03T22:53:43.000Z","updated_at":"2024-05-06T07:59:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"3258ad0b-34c5-4012-820c-de5d59717eb8","html_url":"https://github.com/jw3126/SnapTests.jl","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"7a4324b367813597d6857dfe318d032b4941904d"},"previous_names":["jw3126/snaptests.jl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jw3126/SnapTests.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw3126%2FSnapTests.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw3126%2FSnapTests.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw3126%2FSnapTests.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw3126%2FSnapTests.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jw3126","download_url":"https://codeload.github.com/jw3126/SnapTests.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw3126%2FSnapTests.jl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266936718,"owners_count":24009424,"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-24T02:00:09.469Z","response_time":99,"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":["julia","snapshot","test"],"created_at":"2024-10-30T19:10:27.253Z","updated_at":"2025-07-25T01:17:06.225Z","avatar_url":"https://github.com/jw3126.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnapTests\n\n[![Build Status](https://github.com/jw3126/SnapTests.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/jw3126/SnapTests.jl/actions/workflows/CI.yml?query=branch%3Amain)\n[![Coverage](https://codecov.io/gh/jw3126/SnapTests.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/jw3126/SnapTests.jl)\n\nMinimalistic package for testing values against data stored on disk.\n\n# Usage\n\n```julia\nusing Test\nusing SnapTests\n\npath = \"hello1.txt\"\nwrite(path, \"hello world\")\n@test matchsnap(path, \"hello world\")\n@test matchsnap(path, \"hi world!\") # fail with a diff\n@test matchsnap(\"does_not_exist\", \"hi world!\") # ask for path creation\n\nSnapTests.on_cmp_false = :ask     # ask to update data on disk if test fails\nSnapTests.on_cmp_false = :replace # silently replace data on disk if test fails\nSnapTests.on_cmp_false = :return  # default, matchsnap will just return false\n\n# Customization\n# Lets customize test so that instead of loading from disk, stuff gets looked up from a database\n\nenterprise_db = Dict()\nstruct Lookup\n    key::Symbol\nend\nSnapTests.exists(l::Lookup, value) = haskey(enterprise_db, l.key)\nSnapTests.load(l::Lookup, value) = enterprise_db[l.key]\nSnapTests.save(l::Lookup, value) = (enterprise_db[l.key] = value)\n\n@test matchsnap(Lookup(:key1), 1)\n@test matchsnap(Lookup(:key2), 2)\n@test matchsnap(Lookup(:key2), 2)\n@test matchsnap(Lookup(:key2), 3) # fails\n```\n\n# Tooling\nOne drawback of writing values to a file instead of hard coding them in a test is \nthat reading the test is less self contained.\n\nTo alleviate this, there are ways for various editors to quickly peek the contents of a file.\n\n## Neovim\nUsing [telescope](https://github.com/nvim-telescope/telescope.nvim) one can bind the following to some keys:\n```lua\nrequire('telescope.builtin').find_files({ default_text=vim.fn.expand('\u003ccfile\u003e')})\"\n```\n\n\n# Alternatives\n\n* [ReferenceTests.jl](https://github.com/JuliaTesting/ReferenceTests.jl) \n  Compared to this package many more awesome features. But also heavier dependencies\n  and hard to customize, especially if FileIO does not cover your use case.\n* [SnapshotTests.jl](https://github.com/mattwigway/SnapshotTests.jl)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjw3126%2Fsnaptests.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjw3126%2Fsnaptests.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjw3126%2Fsnaptests.jl/lists"}