diff --git a/.gitignore b/.gitignore index 552537f..359d904 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ DerivedData *.xccheckout # AppCode .idea/ -.swiftpm Carthage @@ -31,3 +30,4 @@ Demo/Pods .build Packages Package.pins +.spm-build \ No newline at end of file diff --git a/Mocker.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata similarity index 72% rename from Mocker.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata index 1ce5194..919434a 100644 --- a/Mocker.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/Mocker.xcodeproj/xcshareddata/xcschemes/Mocker.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Mocker.xcscheme similarity index 55% rename from Mocker.xcodeproj/xcshareddata/xcschemes/Mocker.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Mocker.xcscheme index 6966faa..b68953e 100644 --- a/Mocker.xcodeproj/xcshareddata/xcschemes/Mocker.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Mocker.xcscheme @@ -1,6 +1,6 @@ + + + + + ReferencedContainer = "container:"> + + + + @@ -26,27 +54,16 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - codeCoverageEnabled = "YES"> - - - - + shouldUseLaunchSchemeArgsEnv = "YES"> + skipped = "NO"> + ReferencedContainer = "container:"> @@ -61,15 +78,6 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> - - - - + BlueprintIdentifier = "Mocker_MockerTests" + BuildableName = "Mocker_MockerTests" + BlueprintName = "Mocker_MockerTests" + ReferencedContainer = "container:"> diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/MockerTests.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/MockerTests.xcscheme new file mode 100644 index 0000000..d088089 --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/MockerTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Dangerfile.swift b/Dangerfile.swift deleted file mode 100644 index 335f0cb..0000000 --- a/Dangerfile.swift +++ /dev/null @@ -1,4 +0,0 @@ -import Danger -import WeTransferPRLinter - -WeTransferPRLinter.lint() diff --git a/Mocker.podspec b/Mocker.podspec deleted file mode 100644 index f32f4be..0000000 --- a/Mocker.podspec +++ /dev/null @@ -1,20 +0,0 @@ -Pod::Spec.new do |spec| - spec.name = 'Mocker' - spec.version = '2.7.0' - spec.summary = 'Mock data requests using a custom URLProtocol and run them offline.' - spec.description = 'Mocker is a library written in Swift which makes it possible to mock data requests using a custom URLProtocol and run them offline.' - - spec.homepage = 'https://github.com/WeTransfer/Mocker' - spec.license = { :type => 'MIT', :file => 'LICENSE' } - spec.authors = { - 'Antoine van der Lee' => 'ajvanderlee@gmail.com', - 'Samuel Beek' => 'ik@samuelbeek.com' - } - spec.source = { :git => 'https://github.com/WeTransfer/Mocker.git', :tag => spec.version.to_s } - spec.social_media_url = 'https://twitter.com/WeTransfer' - - spec.ios.deployment_target = '10.0' - spec.source_files = 'Sources/**/*' - spec.swift_version = '5.1' - spec.weak_framework = 'XCTest' -end diff --git a/Mocker.xcodeproj/project.pbxproj b/Mocker.xcodeproj/project.pbxproj deleted file mode 100644 index ffa85e0..0000000 --- a/Mocker.xcodeproj/project.pbxproj +++ /dev/null @@ -1,554 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 501B8FC4247E89C600B885F4 /* XCTest+Mocker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 501B8FC3247E89C600B885F4 /* XCTest+Mocker.swift */; }; - 501E269E1F3DAE370048F39E /* Mocker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 501E26941F3DAE370048F39E /* Mocker.framework */; }; - 503446171F3DB4660039D5E4 /* Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503446141F3DB4660039D5E4 /* Mock.swift */; }; - 503446181F3DB4660039D5E4 /* Mocker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503446151F3DB4660039D5E4 /* Mocker.swift */; }; - 503446191F3DB4660039D5E4 /* MockingURLProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503446161F3DB4660039D5E4 /* MockingURLProtocol.swift */; }; - 50D4606E20653F1F00A85D93 /* Mocker.h in Headers */ = {isa = PBXBuildFile; fileRef = 50D4606B20653F1F00A85D93 /* Mocker.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 50D4607020653F2500A85D93 /* MockedData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50D4605B20653EAF00A85D93 /* MockedData.swift */; }; - 50D4607120653F2700A85D93 /* MockerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50D4605C20653EAF00A85D93 /* MockerTests.swift */; }; - 8ED91F36283AFDC300EA8E99 /* wetransfer_bot_avatar.png in Resources */ = {isa = PBXBuildFile; fileRef = 8ED91F32283AFDC300EA8E99 /* wetransfer_bot_avatar.png */; }; - 8ED91F37283AFDC300EA8E99 /* example.json in Resources */ = {isa = PBXBuildFile; fileRef = 8ED91F34283AFDC300EA8E99 /* example.json */; }; - 8ED91F38283AFDC300EA8E99 /* sample-redirect-get.data in Resources */ = {isa = PBXBuildFile; fileRef = 8ED91F35283AFDC300EA8E99 /* sample-redirect-get.data */; }; - A4B51386288FD81B00C52F4A /* Mock+DataType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B51385288FD81B00C52F4A /* Mock+DataType.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 501E269F1F3DAE370048F39E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 501E268B1F3DAE370048F39E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 501E26931F3DAE370048F39E; - remoteInfo = Mocker; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 501B8FC3247E89C600B885F4 /* XCTest+Mocker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTest+Mocker.swift"; sourceTree = ""; }; - 501B8FC5247E8BDE00B885F4 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 501E26941F3DAE370048F39E /* Mocker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mocker.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 501E269D1F3DAE370048F39E /* MockerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MockerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 501F8B2D237594AC008EF77E /* Mocker.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = Mocker.podspec; sourceTree = ""; }; - 503446141F3DB4660039D5E4 /* Mock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mock.swift; sourceTree = ""; }; - 503446151F3DB4660039D5E4 /* Mocker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mocker.swift; sourceTree = ""; }; - 503446161F3DB4660039D5E4 /* MockingURLProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingURLProtocol.swift; sourceTree = ""; }; - 506277CC235F2777000A4316 /* Changelog.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Changelog.md; sourceTree = ""; }; - 50D4605B20653EAF00A85D93 /* MockedData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockedData.swift; sourceTree = ""; }; - 50D4605C20653EAF00A85D93 /* MockerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockerTests.swift; sourceTree = ""; }; - 50D4606320653EAF00A85D93 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 50D4606B20653F1F00A85D93 /* Mocker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mocker.h; sourceTree = ""; }; - 50D4606D20653F1F00A85D93 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8ED91F32283AFDC300EA8E99 /* wetransfer_bot_avatar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wetransfer_bot_avatar.png; sourceTree = ""; }; - 8ED91F34283AFDC300EA8E99 /* example.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = example.json; sourceTree = ""; }; - 8ED91F35283AFDC300EA8E99 /* sample-redirect-get.data */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sample-redirect-get.data"; sourceTree = ""; }; - A4B51385288FD81B00C52F4A /* Mock+DataType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Mock+DataType.swift"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 501E26901F3DAE370048F39E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 501E269A1F3DAE370048F39E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 501E269E1F3DAE370048F39E /* Mocker.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 501E268A1F3DAE370048F39E = { - isa = PBXGroup; - children = ( - 501B8FC5247E8BDE00B885F4 /* README.md */, - 506277CC235F2777000A4316 /* Changelog.md */, - 501F8B2D237594AC008EF77E /* Mocker.podspec */, - 501E26951F3DAE370048F39E /* Products */, - 50D4606A20653F1F00A85D93 /* Mocker */, - 50D4605A20653EAF00A85D93 /* MockerTests */, - 503446131F3DB4660039D5E4 /* Sources */, - ); - sourceTree = ""; - }; - 501E26951F3DAE370048F39E /* Products */ = { - isa = PBXGroup; - children = ( - 501E26941F3DAE370048F39E /* Mocker.framework */, - 501E269D1F3DAE370048F39E /* MockerTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 503446131F3DB4660039D5E4 /* Sources */ = { - isa = PBXGroup; - children = ( - 503446141F3DB4660039D5E4 /* Mock.swift */, - 503446151F3DB4660039D5E4 /* Mocker.swift */, - 503446161F3DB4660039D5E4 /* MockingURLProtocol.swift */, - 501B8FC3247E89C600B885F4 /* XCTest+Mocker.swift */, - A4B51385288FD81B00C52F4A /* Mock+DataType.swift */, - ); - path = Sources; - sourceTree = ""; - }; - 50D4605A20653EAF00A85D93 /* MockerTests */ = { - isa = PBXGroup; - children = ( - 8ED91F31283AFDC300EA8E99 /* Resources */, - 50D4605B20653EAF00A85D93 /* MockedData.swift */, - 50D4605C20653EAF00A85D93 /* MockerTests.swift */, - 50D4606220653EAF00A85D93 /* Supporting Files */, - ); - path = MockerTests; - sourceTree = ""; - }; - 50D4606220653EAF00A85D93 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 50D4606320653EAF00A85D93 /* Info.plist */, - ); - path = "Supporting Files"; - sourceTree = ""; - }; - 50D4606A20653F1F00A85D93 /* Mocker */ = { - isa = PBXGroup; - children = ( - 50D4606B20653F1F00A85D93 /* Mocker.h */, - 50D4606C20653F1F00A85D93 /* Supporting Files */, - ); - path = Mocker; - sourceTree = ""; - }; - 50D4606C20653F1F00A85D93 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 50D4606D20653F1F00A85D93 /* Info.plist */, - ); - path = "Supporting Files"; - sourceTree = ""; - }; - 8ED91F31283AFDC300EA8E99 /* Resources */ = { - isa = PBXGroup; - children = ( - 8ED91F32283AFDC300EA8E99 /* wetransfer_bot_avatar.png */, - 8ED91F33283AFDC300EA8E99 /* JSON Files */, - 8ED91F35283AFDC300EA8E99 /* sample-redirect-get.data */, - ); - path = Resources; - sourceTree = ""; - }; - 8ED91F33283AFDC300EA8E99 /* JSON Files */ = { - isa = PBXGroup; - children = ( - 8ED91F34283AFDC300EA8E99 /* example.json */, - ); - path = "JSON Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 501E26911F3DAE370048F39E /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 50D4606E20653F1F00A85D93 /* Mocker.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 501E26931F3DAE370048F39E /* Mocker */ = { - isa = PBXNativeTarget; - buildConfigurationList = 501E26A81F3DAE370048F39E /* Build configuration list for PBXNativeTarget "Mocker" */; - buildPhases = ( - 501E26911F3DAE370048F39E /* Headers */, - 501E268F1F3DAE370048F39E /* Sources */, - 501E26901F3DAE370048F39E /* Frameworks */, - 501E26921F3DAE370048F39E /* Resources */, - 503446441F3DE70C0039D5E4 /* SwiftLint */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Mocker; - productName = Mocker; - productReference = 501E26941F3DAE370048F39E /* Mocker.framework */; - productType = "com.apple.product-type.framework"; - }; - 501E269C1F3DAE370048F39E /* MockerTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 501E26AB1F3DAE370048F39E /* Build configuration list for PBXNativeTarget "MockerTests" */; - buildPhases = ( - 501E26991F3DAE370048F39E /* Sources */, - 501E269A1F3DAE370048F39E /* Frameworks */, - 501E269B1F3DAE370048F39E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 501E26A01F3DAE370048F39E /* PBXTargetDependency */, - ); - name = MockerTests; - productName = MockerTests; - productReference = 501E269D1F3DAE370048F39E /* MockerTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 501E268B1F3DAE370048F39E /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 1320; - ORGANIZATIONNAME = WeTransfer; - TargetAttributes = { - 501E26931F3DAE370048F39E = { - CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = GLJTT4T544; - LastSwiftMigration = 1020; - ProvisioningStyle = Automatic; - }; - 501E269C1F3DAE370048F39E = { - CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = GLJTT4T544; - LastSwiftMigration = 1020; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 501E268E1F3DAE370048F39E /* Build configuration list for PBXProject "Mocker" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 501E268A1F3DAE370048F39E; - productRefGroup = 501E26951F3DAE370048F39E /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 501E26931F3DAE370048F39E /* Mocker */, - 501E269C1F3DAE370048F39E /* MockerTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 501E26921F3DAE370048F39E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 501E269B1F3DAE370048F39E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8ED91F36283AFDC300EA8E99 /* wetransfer_bot_avatar.png in Resources */, - 8ED91F38283AFDC300EA8E99 /* sample-redirect-get.data in Resources */, - 8ED91F37283AFDC300EA8E99 /* example.json in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 503446441F3DE70C0039D5E4 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "./Submodules/WeTransfer-iOS-CI/BuildTools/swiftlint.sh\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 501E268F1F3DAE370048F39E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 503446191F3DB4660039D5E4 /* MockingURLProtocol.swift in Sources */, - 501B8FC4247E89C600B885F4 /* XCTest+Mocker.swift in Sources */, - A4B51386288FD81B00C52F4A /* Mock+DataType.swift in Sources */, - 503446181F3DB4660039D5E4 /* Mocker.swift in Sources */, - 503446171F3DB4660039D5E4 /* Mock.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 501E26991F3DAE370048F39E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 50D4607120653F2700A85D93 /* MockerTests.swift in Sources */, - 50D4607020653F2500A85D93 /* MockedData.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 501E26A01F3DAE370048F39E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 501E26931F3DAE370048F39E /* Mocker */; - targetProxy = 501E269F1F3DAE370048F39E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 501E26A61F3DAE370048F39E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 501E26A71F3DAE370048F39E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 501E26A91F3DAE370048F39E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = GLJTT4T544; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks\n$(PLATFORM_DIR)/Developer/Library/Frameworks", - ); - INFOPLIST_FILE = "Mocker/Supporting Files/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.Mocker; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 501E26AA1F3DAE370048F39E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = GLJTT4T544; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks\n$(PLATFORM_DIR)/Developer/Library/Frameworks", - ); - INFOPLIST_FILE = "Mocker/Supporting Files/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.Mocker; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 501E26AC1F3DAE370048F39E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEVELOPMENT_TEAM = GLJTT4T544; - INFOPLIST_FILE = "MockerTests/Supporting Files/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.MockerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 501E26AD1F3DAE370048F39E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEVELOPMENT_TEAM = GLJTT4T544; - INFOPLIST_FILE = "MockerTests/Supporting Files/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.MockerTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 501E268E1F3DAE370048F39E /* Build configuration list for PBXProject "Mocker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 501E26A61F3DAE370048F39E /* Debug */, - 501E26A71F3DAE370048F39E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 501E26A81F3DAE370048F39E /* Build configuration list for PBXNativeTarget "Mocker" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 501E26A91F3DAE370048F39E /* Debug */, - 501E26AA1F3DAE370048F39E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 501E26AB1F3DAE370048F39E /* Build configuration list for PBXNativeTarget "MockerTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 501E26AC1F3DAE370048F39E /* Debug */, - 501E26AD1F3DAE370048F39E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 501E268B1F3DAE370048F39E /* Project object */; -} diff --git a/Mocker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Mocker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Mocker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Mocker/Mocker.h b/Mocker/Mocker.h deleted file mode 100644 index aa513e3..0000000 --- a/Mocker/Mocker.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Mocker.h -// Mocker -// -// Created by Antoine van der Lee on 11/08/2017. -// Copyright © 2017 WeTransfer. All rights reserved. -// - -#import - -//! Project version number for Mocker. -FOUNDATION_EXPORT double MockerVersionNumber; - -//! Project version string for Mocker. -FOUNDATION_EXPORT const unsigned char MockerVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Mocker/Supporting Files/Info.plist b/Mocker/Supporting Files/Info.plist deleted file mode 100644 index fbe1e6b..0000000 --- a/Mocker/Supporting Files/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/MockerTests/Supporting Files/Info.plist b/MockerTests/Supporting Files/Info.plist deleted file mode 100644 index 6c6c23c..0000000 --- a/MockerTests/Supporting Files/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Package.swift b/Package.swift index add4609..d978d20 100644 --- a/Package.swift +++ b/Package.swift @@ -1,29 +1,28 @@ // swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. -// We're hiding dev, test, and danger dependencies with // dev to make sure they're not fetched by users of this package. import PackageDescription -let package = Package(name: "Mocker", - platforms: [ - .macOS(.v10_15), - .iOS(.v10), - .tvOS(.v12), - .watchOS(.v6)], - products: [ - // dev .library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]), - .library(name: "Mocker", targets: ["Mocker"]) - ], - dependencies: [ - // dev .package(name: "danger-swift", url: "https://github.com/danger/swift", from: "3.12.1"), - // dev .package(name: "WeTransferPRLinter", path: "Submodules/WeTransfer-iOS-CI/WeTransferPRLinter") - ], - targets: [ - // dev .target(name: "DangerDependencies", dependencies: [ - // dev .product(name: "Danger", package: "danger-swift"), - // dev .product(name: "WeTransferPRLinter", package: "WeTransferPRLinter") - // dev ], path: "Submodules/WeTransfer-iOS-CI/DangerFakeSources", sources: ["DangerFakeSource.swift"]), - .target(name: "Mocker", path: "Sources"), - .testTarget(name: "MockerTests", dependencies: ["Mocker"], path: "MockerTests", resources: [.process("Resources")]) - ], - swiftLanguageVersions: [.v5]) +let package = Package( + name: "Mocker", + platforms: [ + .macOS(.v10_15), + .iOS(.v11), + .tvOS(.v12), + .watchOS(.v6)], + products: [ + .library(name: "Mocker", targets: ["Mocker"]) + ], + targets: [ + .target( + name: "Mocker" + ), + .testTarget( + name: "MockerTests", + dependencies: ["Mocker"], + resources: [ + .process("Resources") + ] + ) + ], + swiftLanguageVersions: [.v5]) diff --git a/README.md b/README.md index f0c9040..e8f20cc 100644 --- a/README.md +++ b/README.md @@ -246,11 +246,11 @@ You can register on `Mock` callbacks to make testing easier. ```swift var mock = Mock(url: request.url!, dataType: .json, statusCode: 200, data: [.post: Data()]) -mock.onRequest = { request, postBodyArguments in +mock.onRequestHandler = OnRequestHandler(httpBodyType: [[String:String]].self, callback: { request, postBodyArguments in XCTAssertEqual(request.url, mock.request.url) - XCTAssertEqual(expectedParameters, postBodyArguments as? [String: String]) + XCTAssertEqual(expectedParameters, postBodyArguments) onRequestExpectation.fulfill() -} +}) mock.completion = { endpointIsCalledExpectation.fulfill() } @@ -287,32 +287,6 @@ Mocker.removeAll() ## Installation -### CocoaPods - -[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: - -```bash -$ gem install cocoapods -``` - -To integrate Mocker into your Xcode project using CocoaPods, specify it in your `Podfile`: - -```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '10.0' -use_frameworks! - -target '' do - pod 'Mocker', '~> 2.5.4' -end -``` - -Then, run the following command: - -```bash -$ pod install -``` - ### Carthage [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. diff --git a/Sources/Mock+DataType.swift b/Sources/Mocker/Mock+DataType.swift similarity index 100% rename from Sources/Mock+DataType.swift rename to Sources/Mocker/Mock+DataType.swift diff --git a/Sources/Mock.swift b/Sources/Mocker/Mock.swift similarity index 94% rename from Sources/Mock.swift rename to Sources/Mocker/Mock.swift index 1baa3f5..e046ad2 100644 --- a/Sources/Mock.swift +++ b/Sources/Mocker/Mock.swift @@ -32,7 +32,7 @@ public struct Mock: Equatable { case connect = "CONNECT" } - public typealias OnRequest = (_ request: URLRequest, _ httpBodyArguments: Any?) -> Void + public typealias OnRequest = (_ request: URLRequest, _ httpBodyArguments: [String: Any]?) -> Void /// The type of the data which is returned. public let dataType: DataType @@ -82,7 +82,18 @@ public struct Mock: Equatable { public var completion: (() -> Void)? /// The callback which will be executed everytime this `Mock` was started. Can be used within unit tests for validating that a request has been started. The callback must be set before calling `register`. - public var onRequest: OnRequest? + @available(*, deprecated, message: "Use `onRequestHandler` instead.") + public var onRequest: OnRequest? { + set { + onRequestHandler = OnRequestHandler(callback: newValue) + } + get { + onRequestHandler?.legacyCallback + } + } + + /// The on request handler which will be executed everytime this `Mock` was started. Can be used within unit tests for validating that a request has been started. The handler must be set before calling `register`. + public var onRequestHandler: OnRequestHandler? /// Can only be set internally as it's used by the `expectationForRequestingMock(_:)` method. var onRequestExpectation: XCTestExpectation? diff --git a/Sources/Mocker.swift b/Sources/Mocker/Mocker.swift similarity index 100% rename from Sources/Mocker.swift rename to Sources/Mocker/Mocker.swift diff --git a/Sources/MockingURLProtocol.swift b/Sources/Mocker/MockingURLProtocol.swift similarity index 79% rename from Sources/MockingURLProtocol.swift rename to Sources/Mocker/MockingURLProtocol.swift index 5f8b328..020dace 100644 --- a/Sources/MockingURLProtocol.swift +++ b/Sources/Mocker/MockingURLProtocol.swift @@ -46,8 +46,8 @@ open class MockingURLProtocol: URLProtocol { return } - if let onRequest = mock.onRequest { - onRequest(request, request.postBodyArguments) + if let onRequestHandler = mock.onRequestHandler { + onRequestHandler.handleRequest(request) } mock.onRequestExpectation?.fulfill() @@ -108,32 +108,3 @@ private extension Data { return redirectLocation } } - -private extension URLRequest { - var postBodyArguments: Any? { - guard let httpBody = httpBodyStreamData() ?? httpBody else { return nil } - return try? JSONSerialization.jsonObject(with: httpBody, options: .fragmentsAllowed) - } - - /// We need to use the http body stream data as the URLRequest once launched converts the `httpBody` to this stream of data. - private func httpBodyStreamData() -> Data? { - guard let bodyStream = self.httpBodyStream else { return nil } - - bodyStream.open() - - // Will read 16 chars per iteration. Can use bigger buffer if needed - let bufferSize: Int = 16 - let buffer = UnsafeMutablePointer.allocate(capacity: bufferSize) - var data = Data() - - while bodyStream.hasBytesAvailable { - let readData = bodyStream.read(buffer, maxLength: bufferSize) - data.append(buffer, count: readData) - } - - buffer.deallocate() - bodyStream.close() - - return data - } -} diff --git a/Sources/Mocker/OnRequestHandler.swift b/Sources/Mocker/OnRequestHandler.swift new file mode 100644 index 0000000..bfee57b --- /dev/null +++ b/Sources/Mocker/OnRequestHandler.swift @@ -0,0 +1,81 @@ +// +// OnRequestHandler.swift +// +// +// Created by Antoine van der Lee on 03/11/2022. +// Copyright © 2022 WeTransfer. All rights reserved. +// + +import Foundation +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +/// A handler for verifying outgoing requests. +public struct OnRequestHandler { + + public typealias OnRequest = (_ request: URLRequest, _ httpBody: HTTPBody?) -> Void + + private let internalCallback: (_ request: URLRequest) -> Void + let legacyCallback: Mock.OnRequest? + + /// Creates a new request handler using the given `HTTPBody` type, which can be any `Decodable`. + /// - Parameters: + /// - httpBodyType: The decodable type to use for parsing the request body. + /// - callback: The callback which will be called just before the request executes. + public init(httpBodyType: HTTPBody.Type?, callback: @escaping OnRequest) { + self.internalCallback = { request in + guard + let httpBody = request.httpBodyStreamData() ?? request.httpBody, + let decodedObject = try? JSONDecoder().decode(HTTPBody.self, from: httpBody) + else { + callback(request, nil) + return + } + callback(request, decodedObject) + } + legacyCallback = nil + } + + init(callback: Mock.OnRequest?) { + self.internalCallback = { request in + guard + let httpBody = request.httpBodyStreamData() ?? request.httpBody, + let jsonObject = try? JSONSerialization.jsonObject(with: httpBody, options: .fragmentsAllowed) as? [String: Any] + else { + callback?(request, nil) + return + } + callback?(request, jsonObject) + } + self.legacyCallback = callback + } + + func handleRequest(_ request: URLRequest) { + internalCallback(request) + } +} + +private extension URLRequest { + /// We need to use the http body stream data as the URLRequest once launched converts the `httpBody` to this stream of data. + func httpBodyStreamData() -> Data? { + guard let bodyStream = self.httpBodyStream else { return nil } + + bodyStream.open() + + // Will read 16 chars per iteration. Can use bigger buffer if needed + let bufferSize: Int = 16 + let buffer = UnsafeMutablePointer.allocate(capacity: bufferSize) + var data = Data() + + while bodyStream.hasBytesAvailable { + let readData = bodyStream.read(buffer, maxLength: bufferSize) + data.append(buffer, count: readData) + } + + buffer.deallocate() + bodyStream.close() + + return data + } +} diff --git a/Sources/XCTest+Mocker.swift b/Sources/Mocker/XCTest+Mocker.swift similarity index 100% rename from Sources/XCTest+Mocker.swift rename to Sources/Mocker/XCTest+Mocker.swift diff --git a/Submodules/WeTransfer-iOS-CI b/Submodules/WeTransfer-iOS-CI index 712d9d1..9051b96 160000 --- a/Submodules/WeTransfer-iOS-CI +++ b/Submodules/WeTransfer-iOS-CI @@ -1 +1 @@ -Subproject commit 712d9d1f93b631fb17ca155c382db309342e263e +Subproject commit 9051b9622a56fdc6c4fbf0a30ba840a185d6b896 diff --git a/MockerTests/MockTests.swift b/Tests/MockerTests/MockTests.swift similarity index 100% rename from MockerTests/MockTests.swift rename to Tests/MockerTests/MockTests.swift diff --git a/MockerTests/MockedData.swift b/Tests/MockerTests/MockedData.swift similarity index 100% rename from MockerTests/MockedData.swift rename to Tests/MockerTests/MockedData.swift diff --git a/MockerTests/MockerTests.swift b/Tests/MockerTests/MockerTests.swift similarity index 99% rename from MockerTests/MockerTests.swift rename to Tests/MockerTests/MockerTests.swift index 949df1f..4d3cb92 100644 --- a/MockerTests/MockerTests.swift +++ b/Tests/MockerTests/MockerTests.swift @@ -342,11 +342,11 @@ final class MockerTests: XCTestCase { request.httpBody = try JSONSerialization.data(withJSONObject: expectedParameters, options: .prettyPrinted) var mock = Mock(url: request.url!, dataType: .json, statusCode: 200, data: [.post: Data()]) - mock.onRequest = { request, postBodyArguments in + mock.onRequestHandler = OnRequestHandler(httpBodyType: [[String:String]].self, callback: { request, postBodyArguments in XCTAssertEqual(request.url, mock.request.url) - XCTAssertEqual(expectedParameters, postBodyArguments as? [[String: String]]) + XCTAssertEqual(expectedParameters, postBodyArguments) onRequestExpectation.fulfill() - } + }) mock.register() URLSession.shared.dataTask(with: request).resume() diff --git a/MockerTests/Resources/JSON Files/example.json b/Tests/MockerTests/Resources/JSON Files/example.json similarity index 100% rename from MockerTests/Resources/JSON Files/example.json rename to Tests/MockerTests/Resources/JSON Files/example.json diff --git a/MockerTests/Resources/sample-redirect-get.data b/Tests/MockerTests/Resources/sample-redirect-get.data similarity index 100% rename from MockerTests/Resources/sample-redirect-get.data rename to Tests/MockerTests/Resources/sample-redirect-get.data diff --git a/MockerTests/Resources/wetransfer_bot_avatar.png b/Tests/MockerTests/Resources/wetransfer_bot_avatar.png similarity index 100% rename from MockerTests/Resources/wetransfer_bot_avatar.png rename to Tests/MockerTests/Resources/wetransfer_bot_avatar.png diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 6833cf1..b4bb675 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -6,7 +6,14 @@ import "./../Submodules/WeTransfer-iOS-CI/Fastlane/shared_lanes.rb" desc "Run the tests and prepare for Danger" lane :test do |options| - test_project( - project_name: "Mocker", - scheme: "Mocker") + + # Remove any leftover reports before running so CI won't fail due to an existing file. + # This also helps for local running this workflow frequently. + sh("rm -rf #{ENV['PWD']}/build/reports") + + test_package( + package_name: 'Mocker', + package_path: ENV['PWD'], + disable_automatic_package_resolution: false + ) end