feat: Renames some options, adds a require-configuration option that fails if configuration is not found.
All checks were successful
CI / Ubuntu (push) Successful in 2m19s
All checks were successful
CI / Ubuntu (push) Successful in 2m19s
This commit is contained in:
@@ -138,11 +138,12 @@ extension CliClient.SharedOptions {
|
||||
) -> Self {
|
||||
return .init(
|
||||
dryRun: dryRun,
|
||||
gitDirectory: gitDirectory,
|
||||
projectDirectory: gitDirectory,
|
||||
loggingOptions: .init(command: "test", verbose: 2),
|
||||
target: .init(module: .init(target)),
|
||||
branch: versionStrategy.branch,
|
||||
semvar: versionStrategy.semvar
|
||||
configurationToMerge: .init(
|
||||
target: .init(module: .init(target)),
|
||||
strategy: versionStrategy
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
@_spi(Internal) import CliClient
|
||||
import Dependencies
|
||||
import FileClient
|
||||
import GitClient
|
||||
import ShellClient
|
||||
import TestSupport
|
||||
import XCTest
|
||||
|
||||
// TODO: Remove
|
||||
final class GitVersionTests: XCTestCase {
|
||||
|
||||
override func invokeTest() {
|
||||
withDependencies({
|
||||
$0.logger.logLevel = .debug
|
||||
$0.logger = .liveValue
|
||||
$0.asyncShellClient = .liveValue
|
||||
$0.gitClient = .liveValue
|
||||
$0.fileClient = .liveValue
|
||||
}, operation: {
|
||||
super.invokeTest()
|
||||
})
|
||||
}
|
||||
|
||||
var gitDir: String {
|
||||
URL(fileURLWithPath: #file)
|
||||
.deletingLastPathComponent()
|
||||
.deletingLastPathComponent()
|
||||
.deletingLastPathComponent()
|
||||
.cleanFilePath
|
||||
}
|
||||
|
||||
// #if !os(Linux)
|
||||
// func test_live() async throws {
|
||||
// @Dependency(\.gitClient) var versionClient: GitClient
|
||||
//
|
||||
// let version = try await versionClient.currentVersion(in: gitDir)
|
||||
// print("VERSION: \(version)")
|
||||
// // can't really have a predictable result for the live client.
|
||||
// XCTAssertNotEqual(version, "blob")
|
||||
// }
|
||||
// #endif
|
||||
|
||||
func test_file_client() async throws {
|
||||
try await withTemporaryDirectory { tmpDir in
|
||||
@Dependency(\.fileClient) var fileClient
|
||||
|
||||
let filePath = tmpDir.appendingPathComponent("blob.txt")
|
||||
try await fileClient.write(string: "Blob", to: filePath)
|
||||
|
||||
let contents = try await fileClient.read(filePath)
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
XCTAssertEqual(contents, "Blob")
|
||||
}
|
||||
}
|
||||
|
||||
func test_file_client_with_string_path() async throws {
|
||||
try await withTemporaryDirectory { tmpDir in
|
||||
@Dependency(\.fileClient) var fileClient
|
||||
|
||||
let filePath = tmpDir.appendingPathComponent("blob.txt")
|
||||
let fileString = filePath.cleanFilePath
|
||||
|
||||
try await fileClient.write(string: "Blob", to: fileString)
|
||||
|
||||
let contents = try await fileClient.read(fileString)
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
XCTAssertEqual(contents, "Blob")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
@_spi(Internal) import ConfigurationClient
|
||||
import CustomDump
|
||||
import Dependencies
|
||||
import Foundation
|
||||
import Testing
|
||||
@@ -91,8 +92,8 @@ struct ConfigurationClientTests {
|
||||
let other = Configuration.VersionStrategy.semvar(.init(
|
||||
allowPreRelease: true,
|
||||
preRelease: .init(prefix: "foo", strategy: .gitTag),
|
||||
requireExistingFile: true,
|
||||
requireExistingSemVar: true,
|
||||
requireExistingFile: false,
|
||||
requireExistingSemVar: false,
|
||||
strategy: .gitTag()
|
||||
))
|
||||
let merged = strategy1.merging(other)
|
||||
|
||||
Reference in New Issue
Block a user