Files
SwiftLint/Tests/SwiftLintFrameworkTests/XCTestCase+BundlePath.swift
JP SimardandGitHub c84124d8bc Enable all tests when using rules_xcodeproj (#4723)
* 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.
2023-01-26 21:18:05 -05:00

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 }
}