Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot adds imported module's name that fails match with reference shapshot #819

Open
kapitoshka438 opened this issue Dec 27, 2023 · 0 comments

Comments

@kapitoshka438
Copy link

Describe the bug
Our project includes several application targets and test target for each of them for environments split purposes. The source code is common for all environments. We import application modules to their test modules through @testable import this way:

#if canImport(App_dev)
@testable import App_dev
#elseif canImport(App_test)
@testable import App_test
#elseif canImport(App_pre)
@testable import App_pre
#endif

So each test scheme imports a corresponding application target module.

However, generated snapshots put app target module name for their class names that make out snapshot tests fail.
Is there a way to disable module names and avoid creating separate reference snapshots for each environment?

Error Message

test_mutate_whenGoToCatalog_withInitialState_shouldSucceed(): failed - Snapshot does not match reference.

ksDiff "/Users/EMiniakhmetov/ostin-ios-app/Ostin/Tests/Resources/Snapshots/Chat/ChatWebViewMutatorTests/ChatWebViewMutatorTests_test_mutate_whenGoToCatalog_withInitialState_shouldSucceed.1.txt" "/Users/EMiniakhmetov/Library/Developer/CoreSimulator/Devices/5797389E-3B79-4513-A77B-1DF77AF31459/data/Containers/Data/Application/EA522DB9-3AD6-47F2-962D-911EB705C061/tmp/ChatWebViewMutatorTests/ChatWebViewMutatorTests_test_mutate_whenGoToCatalog_withInitialState_shouldSucceed.1.txt"

@@ −1,1 +1,1 @@
−[ChatWebViewMutation.setRoutingTarget(Optional(ChatWebViewModuleState.ViewState.RoutingTarget.catalog)), ChatWebViewMutation.setRoutingTarget(nil)]
+[Ostin_test.ChatWebViewMutation.setRoutingTarget(Optional(Ostin_test.ChatWebViewModuleState.ViewState.RoutingTarget.catalog)), Ostin_test.ChatWebViewMutation.setRoutingTarget(nil)]

Environment

  • swift-snapshot-testing version 1.15.1
  • Xcode 15.1
  • Swift 5.9
  • OS: iOS 17.2
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

No branches or pull requests

1 participant