Tyler-Keith-Thompson / CucumberSwift

A lightweight swift Cucumber implementation
https://tyler-keith-thompson.github.io/CucumberSwift/documentation/cucumberswift/
MIT License
74 stars 19 forks source link

Broken Gherkin language support due to 951bdd3a48900e24d528f0ac65814e2a06dbfdb5 #83

Closed DevMobileAS closed 1 year ago

DevMobileAS commented 1 year ago

Describe the bug Due to the commit 951bdd3a48900e24d528f0ac65814e2a06dbfdb5 the language support got broken. We tracked it down to the exact (missing) change, but are unable to find the correct way to fix it, because we're unclear why the code was needed before.

CucumberSwift/Sources/CucumberSwift/Gherkin/Language.swift

        let bundle = Bundle(for: Cucumber.self).resolvedForSPM
        if  let path = bundle.path(forResource: "gherkin-languages", ofType: "json"),

This tries to find the file gherkin-languages but unfortunately since the change resolvedForSPM doesn't work correctly anymore. Before the change (removing CucumberSwift_ObjC) the method returned Bundle.module. Afterwards it returns just self - thus the parent directory, which doesn't contain the json file.

By changing CucumberSwift/Sources/CucumberSwift/Extensions/BundleExtensions.swift to this:

extension Bundle {
    var resolvedForSPM: Bundle {
        return Bundle.module
    }
}

... all our tests are working again.

Additional context Add any other context about the problem here.

Tyler-Keith-Thompson commented 1 year ago

Uh oh, I'll work on this ASAP.

Tyler-Keith-Thompson commented 1 year ago

This should be fixed in 4.0.8