Skip to content

Remove Test::More dependency in favor of Test2::API#3

Open
yuu-no wants to merge 3 commits intomohawk2:masterfrom
yuu-no:master
Open

Remove Test::More dependency in favor of Test2::API#3
yuu-no wants to merge 3 commits intomohawk2:masterfrom
yuu-no:master

Conversation

@yuu-no
Copy link
Copy Markdown

@yuu-no yuu-no commented Feb 6, 2026

Summary

This PR removes the runtime dependency on Test::More, making Test::Snapshot compatible with Test2::V0 directly.

Changes

  • Replace require Test::More with pure Test2::API usage
  • Use $ctx->pass/fail/diag instead of Test::More::pass/fail/diag
  • Remove $Test::Builder::Level manipulation (no longer needed with context)
  • Capture subtest names via test2_add_callback_pre_subtest and Hub metadata
  • Refactor _get_filename() to use $0 and Hub metadata instead of Test::Builder metadata

Motivation

Users who prefer Test2::V0 over Test::More can now use Test::Snapshot without pulling in Test::More as a runtime dependency. This also simplifies the codebase by using the modern Test2::API directly.

Test plan

  • Existing tests pass (prove -lr t/)
  • Added t/snapshot-test2.t for Test2::V0 compatibility testing
  • Renamed t/snapshot.tt/snapshot-testmore.t to clarify test coverage

@yuu-no
Copy link
Copy Markdown
Author

yuu-no commented Mar 30, 2026

Hi @mohawk2,

I’m just following up on this PR. I believe this change would be beneficial for the project. Could you please take a look when you have a moment?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant