Snap.swift
Snap.swift copied to clipboard
Remove `test` method prefix from reference files
Currently, when I follow the XCTest naming guidelines and write test names like this:
func testBasicRendering() {
expect(snapshotView).toMatchSnapshot()
}
I get files named like this:
[email protected]
I would have expected the name to be reference_basicrendering
, so the test
prefix should be removed as it is part of any test method. It's redundant information.
Hey mate, thanks for the feedback, I think we can make that option configurable so it's opt-in and the current tests for users don't break, also, I don't know if you know that you can pass a custom name to any snapshot like this
expect(snapshotView).toMatchSnapshot(named: "basic_rendering")
I know that, but I think the defaults should definitely be more swifty
or at least provide the option to be so. Another possibility is that we keep support for the test
prefix when matching, but only create new references without the test
prefix. That way existing tests would still work but the redundant stuff would be gone long term.
Yeah, I think we can do something like that using the Snap Config so it's opt-in by the user, I'll try to do that this afternoon