{"id":15403403,"url":"https://github.com/mbj/tasty-mgolden","last_synced_at":"2025-08-20T17:05:33.850Z","repository":{"id":56879967,"uuid":"216692430","full_name":"mbj/tasty-mgolden","owner":"mbj","description":"A different golden testing provider for tasty.","archived":false,"fork":false,"pushed_at":"2020-09-23T21:23:54.000Z","size":58,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-16T18:19:27.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbj.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}},"created_at":"2019-10-22T00:50:33.000Z","updated_at":"2020-09-23T21:23:56.000Z","dependencies_parsed_at":"2022-08-20T23:10:43.611Z","dependency_job_id":null,"html_url":"https://github.com/mbj/tasty-mgolden","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mbj/tasty-mgolden","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Ftasty-mgolden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Ftasty-mgolden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Ftasty-mgolden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Ftasty-mgolden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbj","download_url":"https://codeload.github.com/mbj/tasty-mgolden/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbj%2Ftasty-mgolden/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271353975,"owners_count":24744995,"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-08-20T02:00:09.606Z","response_time":69,"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":[],"created_at":"2024-10-01T16:08:23.403Z","updated_at":"2025-08-20T17:05:33.789Z","avatar_url":"https://github.com/mbj.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/mbj/tasty-mgolden/workflows/CI/badge.svg)\n\n# tasty-mgolden\n\nText based [golden tests](https://ro-che.info/articles/2017-12-04-golden-tests)\nfor [tasty](https://github.com/feuerbach/tasty), with multi line (colored) diff expectation\nfailure reporting.\n\nBasically this package can turn any `IO Text` action into a golden test via providing a\n`FilePath`.\n\nThis package is the small brother of [tasty-golden](https://github.com/feuerbach/tasty-golden)\nwhich also implements the same golden testing pattern.\n\n`tasty-mgolden` is less generic and more opinionated than its bigger brother.\nBut for that reason can also offer more ergonomic defaults for its core use case:\n\nGolden testing for `IO Text` actions. Where:\n\n* The text value is assuemd to contain multiple lines.\n* The expectation failures can be rendered nicely in multi line diffs.\n* The diff lines are colored via the tasty infrastructure\n* The diff rendering is not done via the external `diff` command, but uses the `Diff` package.\n\nExpectation diffs are rendered like developers are used to:\n\n* Removed lines rendered in red.\n* Added lines in green.\n\n## Usage\n\nThis is taken from the [example](example) directory in the repository.\n\nTo run these execute from repository root:\n\n```\nstack build\nstack exec tasty-mgolden-example\n```\n\nContents of [example/example-a.txt](example/example-a.txt)\n\n```\nfoo\nbar\n```\n\nContents of [example/example-b.txt](example/example-b.txt)\n\n```\nfoo\nbar\n```\n\nContents: `example/Test.hs`\n\n```haskell\nimport Test.Tasty\nimport Test.Tasty.MGolden\n\nmain :: IO ()\nmain = defaultMain $ testGroup \"golden tests\"\n  [ goldenTest \"example-a\" \"example/example-a.txt\" $ pure \"foo\\nbar\\n\"\n  , goldenTest \"example-b\" \"example/example-b.txt\" $ pure \"foo\\nbaz\\n\"\n  ]\n```\n\nOutput:\n\n```diff\ngolden tests\n  example-a: OK\n  example-b: FAIL\n foo\n-bar\n+baz\n\n1 out of 2 tests failed (0.00s)\n```\n\nPassing the `--update` flag to accept the changes:\n\n```\ngolden tests\n  example-a: OK\n  example-b: OK\n    UPDATE\n\nAll 2 tests passed (0.00s)\n```\n\n### TODOs\n\nPRs on these are welcome.\n\n* Improve the multi line diff reporting to only show a\n  minimal context around the changed hunks.\n* Add line markers in unified diff format.\n* Change to `pathtype` from `filepath`\n* Future? Upstream this to `tasty-golden` ?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Ftasty-mgolden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbj%2Ftasty-mgolden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbj%2Ftasty-mgolden/lists"}