Undefined step using simple Go example
- Dominant language
- TypeScript
- Stars
- 88
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
### 👓 What did you see?
I used the simple Godogs example code in VSCode and it runs fine. The extension is working as I see the feature file with the cucumber icon and syntax is correctly colored. However, my step definitions are underlined (error) and reporting "Undefined step". I do not have this problem with Java.
The extension says it supports Go, but I am wondering if the extension cannot actually find the step definitions. I tried to put the step definitions in the same "features" folder as the feature as well as in the root folder.
Here is the feature file:
```feature
Feature: eat godogs
Scenario: Eat 5 out of 12
Given there are 12 godogs
When I eat 5
Then there should be 7 remaining
```
Here is the step definition:
```go
func TestFeatures(t *testing.T) {
suite := godog.TestSuite{
ScenarioInitializer: InitializeScenario,
Options: &godog.Options{
Format: "pretty",
Paths: []string{"features"},
TestingT: t, // Testing instance that will run subtests.
},
}
if suite.Run() != 0 {
t.Fatal("non-zero status returned, failed to run feature tests")
}
}
func InitializeScenario(sc *godog.ScenarioContext) {
sc.Given(`^there are (\d+) godogs$`, thereAreGodogs)
sc.When(`^I eat (\d+)$`, iEat)
sc.Then(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
}
```
Any help would be appreciated!
### ✅ What did you expect to see?
I should be able to jump from the step to the step definition.
### 📦 Which tool/library version are you using?
vscode: 1.91.1
go: 1.21.0
godog: 0.14.1
### 🔬 How could we reproduce it?
_No response_
### 📚 Any additional context?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.