mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
* Revert "Skip tests requiring runfiles support when testing with rules_xcodeproj (#4694)"
This reverts commit 040096a641.
* Enable all tests when using rules_xcodeproj
Turns out we don't need runfiles support
(https://github.com/buildbuddy-io/rules_xcodeproj/issues/828) since the
tests run outside the sandbox in Xcode, so we can get the path to these
files from the `BUILD_WORKSPACE_DIRECTORY` environment variable that
`bazel test` sets.
21 lines
587 B
Swift
21 lines
587 B
Swift
import Foundation
|
|
import XCTest
|
|
|
|
enum TestResources {
|
|
static var path: String {
|
|
if let rootProjectDirectory = ProcessInfo.processInfo.environment["BUILD_WORKSPACE_DIRECTORY"] {
|
|
return "\(rootProjectDirectory)/Tests/SwiftLintFrameworkTests/Resources"
|
|
}
|
|
|
|
return URL(fileURLWithPath: #file, isDirectory: false)
|
|
.deletingLastPathComponent()
|
|
.appendingPathComponent("Resources")
|
|
.path
|
|
.absolutePathStandardized()
|
|
}
|
|
}
|
|
|
|
extension XCTestCase {
|
|
var testResourcesPath: String { TestResources.path }
|
|
}
|