Skip to content

Make start return SnapshotVerifier #53

Description

@jackmatt2

Currently we use static expect() and rely on ThreadLocal to choose the correct Thread. The logic to do this is becoming messy and unreliable - Threads are shared across methods and it also doesn't work with parallel tests #43 .

Instead of using static methods, use the testing framework to inject the instance created via start() into the test. Different testing framework have different ways of doing this.

My initial though is to inject it into the method signature but there might be other ways such as an instance variable.

@Test
public void myTest(SnapshotMatcher expect) {
  expect("Hello World").toMatchSnapshot();
}

This may warrant a 3.0.0 version upgrade.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions