{"id":17635925,"url":"https://github.com/mohawk2/test-snapshot","last_synced_at":"2025-05-05T23:43:23.183Z","repository":{"id":56833491,"uuid":"116534049","full_name":"mohawk2/Test-Snapshot","owner":"mohawk2","description":"Snapshot-based testing for Perl 5","archived":false,"fork":false,"pushed_at":"2018-02-23T02:19:38.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T00:51:14.394Z","etag":null,"topics":["perl","snapshot-testing","tests"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Test::Snapshot","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohawk2.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-07T03:26:45.000Z","updated_at":"2024-03-05T15:06:53.000Z","dependencies_parsed_at":"2022-09-08T07:41:32.331Z","dependency_job_id":null,"html_url":"https://github.com/mohawk2/Test-Snapshot","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/mohawk2%2FTest-Snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohawk2%2FTest-Snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohawk2%2FTest-Snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohawk2%2FTest-Snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohawk2","download_url":"https://codeload.github.com/mohawk2/Test-Snapshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596321,"owners_count":21773842,"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":["perl","snapshot-testing","tests"],"created_at":"2024-10-23T02:24:39.930Z","updated_at":"2025-05-05T23:43:23.148Z","avatar_url":"https://github.com/mohawk2.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nTest::Snapshot - test against data stored in automatically-named file\n\n# PROJECT STATUS\n\n| OS      |  Build status |\n|:-------:|--------------:|\n| Linux   | [![Build Status](https://travis-ci.org/mohawk2/Test-Snapshot.svg?branch=master)](https://travis-ci.org/mohawk2/Test-Snapshot) |\n\n[![CPAN version](https://badge.fury.io/pl/Test-Snapshot.svg)](https://metacpan.org/pod/Test::Snapshot)\n\n# SYNOPSIS\n\n    use Test::Snapshot;\n    my $got = function_generating_data();\n    is_deeply_snapshot $got, 'test description'; # could also be in a subtest\n\n    # command line:\n    TEST_SNAPSHOT_UPDATE=1 prove -lr t\n    # or\n    TEST_SNAPSHOT_UPDATE=1 make test\n    # if your code means the expected data should change, then inspect with\n    git diff -w\n\n# DESCRIPTION\n\nNot connected with [Test::Snapshots](https://metacpan.org/pod/Test::Snapshots), which is based on a similar\nconcept but for running executables.\n\nImplements a function to automate the storing and updating of expected\ntest outputs. This is based on the idea known in frontend development\ncircles as \"snapshot testing\", hence the module name.\n\nThese snapshots will be stored in files whose names are automatically\ngenerated from:\n\n- the test filename (`$0`)\n- any subtests' names surrounding and including this one\n- the test description if any\n\nIf that file is not present, it will be treated as though it contains\nan `undef`.\n\n# FUNCTIONS\n\n## is\\_deeply\\_snapshot\n\nExported by default. Takes two mandatory arguments:\n\n- The \"got\" data (mandatory), a scalar which might be a reference. It will\nbe passed to [\"is\\_deeply\" in Test::More](https://metacpan.org/pod/Test::More#is_deeply) to be compared to the snapshotted\ndata.\n- A text description of this test (mandatory). It will be used for reporting\nresults, but also to derive the filename in which the \"expected\" data\nis stored.\n\nWill return the truth value of whether the test passed this time -\nsee below for automatic updating of \"expected\" data.\n\n# ENVIRONMENT\n\nTo have this module automatically update its \"expected\" data, set\nenvironment variable `TEST_SNAPSHOT_UPDATE` to a true value. If the\ngot and expected data do not match, a test failure will be reported,\nbut the \"expected\" data will be updated anyway.\n\nThis means it is safe to always have the variable set to a true value,\nso long as you are using source control (you _are_ using source control,\nright?) and check your diffs before committing.\n\n# FILE FORMAT\n\nThe \"expected\" data will be stored in a format generated by\n[\"Dumper\" in Data::Dumper](https://metacpan.org/pod/Data::Dumper#Dumper), with these values set to true, to maximise\nreadability (and to minimise diffs) of the stored data:\n\n- Sortkeys\n- Indent\n- Terse\n\n# AUTHOR\n\nEd J, `\u003cetj at cpan.org\u003e`\n\n# LICENSE\n\nCopyright (C) Ed J\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohawk2%2Ftest-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohawk2%2Ftest-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohawk2%2Ftest-snapshot/lists"}