{"id":26928730,"url":"https://github.com/ktanaka101/dart-inline-snapshot","last_synced_at":"2026-04-18T00:01:58.243Z","repository":{"id":64910780,"uuid":"578998433","full_name":"ktanaka101/dart-inline-snapshot","owner":"ktanaka101","description":"A library that supports inline snapshot testing for Dart.  Allows updating expected results based on actual results.","archived":false,"fork":false,"pushed_at":"2022-12-17T13:48:08.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T13:50:27.080Z","etag":null,"topics":["dart","flutter","snapshot","snapshot-testing","testing"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/ktanaka101.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-12-16T12:03:55.000Z","updated_at":"2022-12-17T12:58:43.000Z","dependencies_parsed_at":"2022-12-17T15:19:36.961Z","dependency_job_id":null,"html_url":"https://github.com/ktanaka101/dart-inline-snapshot","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ktanaka101/dart-inline-snapshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktanaka101%2Fdart-inline-snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktanaka101%2Fdart-inline-snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktanaka101%2Fdart-inline-snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktanaka101%2Fdart-inline-snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ktanaka101","download_url":"https://codeload.github.com/ktanaka101/dart-inline-snapshot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktanaka101%2Fdart-inline-snapshot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31950891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dart","flutter","snapshot","snapshot-testing","testing"],"created_at":"2025-04-02T04:27:38.702Z","updated_at":"2026-04-18T00:01:58.213Z","avatar_url":"https://github.com/ktanaka101.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inline snapshot\n\n[![test](https://github.com/ktanaka101/dart-inline-snapshot/actions/workflows/test.yaml/badge.svg)](https://github.com/ktanaka101/dart-inline-snapshot/actions/workflows/test.yaml) [![Pub Package](https://img.shields.io/pub/v/inline_snapshot.svg)](https://pub.dev/packages/inline_snapshot) [![likes](https://img.shields.io/pub/likes/inline_snapshot?logo=dart)](https://pub.dev/packages/inline_snapshot/score) [![popularity](https://img.shields.io/pub/popularity/inline_snapshot?logo=dart)](https://pub.dev/packages/inline_snapshot/score) [![pub points](https://img.shields.io/pub/points/inline_snapshot?logo=dart)](https://pub.dev/packages/inline_snapshot/score)\n\nA library that supports inline snapshot testing for Dart, inspired by [expect-test](https://github.com/rust-analyzer/expect-test), [rspec-inline-snapshot](https://github.com/Hummingbird-RegTech/rspec-inline-snapshot), [Jest](https://jestjs.io/), and others!\n\nhttps://user-images.githubusercontent.com/10344925/208234218-a1629767-4dc6-4455-9407-c99ea86f2265.mov\n\n## Features\n\n- Performs inline snapshot testing\n- Allows updating expected results based on actual results\n\n## What is convenient?\n\nExpected results are not written to an external file, but rather stored in the same location as the input. This makes it easy to verify the input and expected result together. Since the test can be automatically updated, the only cost of modifying the test is reviewing the differences detected.\n\nHere are some examples of cases where inline snapshot testing might be useful:\n\n- Testing parser results (e.g., ASTs) in programming languages\n- Testing the output of a code formatter\n- Testing the output of a code minifier\n- Testing the output of a templating engine\n- Testing the output of a serialization/deserialization process\n- Testing the output of a data transformation or mapping function\n\nIn each of these cases, the expected results are likely to be small and subject to change, and inline snapshot testing allows you to easily update the expected results and verify the input and output together in the same location.\n\n## Getting started\n\nAdd the following dev dependency to your `pubspec.yaml` file:\n\n```yml\ndev_dependencies:\n  inline_snapshot: ^1.0.2\n```\n\n## Usage\n\n```dart\nimport 'package:test/test.dart';\nimport 'package:inline_snapshot/inline_snapshot.dart';\n\nvoid main() {\n  tearDownAll(() async {\n    await Expect.apply();\n  });\n\n  group('A group of tests', () {\n    test('First Test', () {\n      var e = Expect();\n      //             ^Replace \"actual string\" with `UPDATE_EXPECT=1 dart test`\n      e.eq(\"actual string\");\n    });\n  });\n}\n```\n\nIn the above example, the `Expect` object is empty. You can update the expected result in the source code by running the following command: `UPDATE_EXPECT=true dart test`.\nThis will update the expected result in the source code, as shown below:\n\n```dart\nimport 'package:test/test.dart';\nimport 'package:inline_snapshot/inline_snapshot.dart';\n\nvoid main() {\n  tearDownAll(() async {\n    await Expect.apply();\n  });\n\n  group('A group of tests', () {\n    test('First Test', () {\n      var e = Expect(\"actual string\");\n      //             ^replaced \"actual string\"!!\n      e.eq(\"actual string\");\n    });\n  });\n}\n```\n\nYou can set `UPDATE_EXPECT` to either `1` or `true`.\nIf it is not specified, the Expect object behaves similarly to `expect(actual, expected)`, with leading newlines in the expected result being removed before comparison.\n\n## How it works\n\nWhen you call `Expect(\"expect string\")`, the expected result and the location of the caller are stored. When `Expect#eq(actual: String)` is called, actual is compared to the expected result. If they match, the test is considered a success and no further action is taken. If they do not match, the expected result is marked for replacement. When `Expect.apply()` is executed, the actual values marked for replacement are replaced with the expected results.\n\n## Contributors\n\n- [ktanaka101](https://github.com/ktanaka101) - creator, maintainer\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktanaka101%2Fdart-inline-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fktanaka101%2Fdart-inline-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktanaka101%2Fdart-inline-snapshot/lists"}