Skip to content

Commit

Permalink
Fix paths to custom stencil templates
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Feb 23, 2024
1 parent dcee157 commit 9ae4206
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions PrefireExecutable/Sources/prefire/Config/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Config {
var tests = TestsConfig()
var playbook = PlaybookConfig()

init?(from configDataString: String) {
init?(from configDataString: String, configURL: URL) {
var isTestConfig = false
var isPlaybookConfig = false

Expand Down Expand Up @@ -55,7 +55,7 @@ struct Config {
continue
}
if let template = Config.getValue(from: components, key: .template_file_path) {
tests.template = template
tests.template = configURL.deletingLastPathComponent().path() + template
continue
}
if let device = Config.getValue(from: components, key: .simulator_device) {
Expand Down Expand Up @@ -126,7 +126,7 @@ extension Config {
print("🟢 The '.prefire' file is used on the path: \(configUrl.path)")
}

if let configuration = Config(from: configDataString) {
if let configuration = Config(from: configDataString, configURL: configUrl) {
return configuration
}
}
Expand Down
4 changes: 2 additions & 2 deletions PrefireExecutable/Tests/PrefireTests/ConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class ConfigTests: XCTestCase {
"""

func test_successCreateConfig() {
let config = Config(from: prefireConfigString)
let config = Config(from: prefireConfigString, configURL: URL(string: "some/config/path/.prefire.yml")!)

XCTAssertEqual(config?.tests.target, "PrefireExample")
XCTAssertEqual(config?.tests.testFilePath, "PrefireExampleTests/PreviewTests.generated.swift")
XCTAssertEqual(config?.tests.template, "CustomPreviewTests.stencil")
XCTAssertEqual(config?.tests.template, "some/config/path/CustomPreviewTests.stencil")
XCTAssertEqual(config?.tests.device, "iPhone15,2")
XCTAssertEqual(config?.tests.osVersion, "17")
XCTAssertEqual(config?.tests.previewDefaultEnabled, true)
Expand Down

0 comments on commit 9ae4206

Please sign in to comment.