cucumber / cucumber/vscode

Compiled TypeScript glue code/steps in in node_modules are not being recognized by autocomplete

Open
#253 2 comments 0 reactions 0 assignees View on GitHub
:bug: bug
Dominant language
TypeScript
Stars
88
Forks
33
PR merge metrics
No merged PRs in 30d

Description

### 👓 What did you see?

At my company we have a set of common steps which we keep in a common npm library which we all import into our individual projects. I have some step definitions that I am importing from a compiled TypeScript source.

Here is a snippet of how the compiled .js file looks like:

`
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cucumberSteps = void 0;
///
const cucumber_1 = require("@cucumber/cucumber");
const apiClient_1 = require("../../apiClient");
const apiStepsFunctionHelpers_1 = require("./helpers");
let apiClient = (0, apiClient_1.getApiClient)();

(0, cucumber_1.Given)('I set the endpoint to {string}', function (endpoint) {
(0, apiStepsFunctionHelpers_1.setEndpoint)(this, endpoint);
});
(0, cucumber_1.When)('I set the header(s) to:', function (headersTable) {
const headers = headersTable.rowsHash();
(0, apiClient_1.setHeaders)(apiClient, headers);
});
(0, cucumber_1.Then)(/^the response status should be (\d{3})$/, function (status) {
(0, apiStepsFunctionHelpers_1.assertResponseStatus)(this, status);
});

exports.cucumberSteps = {
Given: cucumber_1.Given,
When: cucumber_1.When,
Then: cucumber_1.Then,
};
`

While running cucumber-js with the glue code path correctly set into my cucumber.js config file, the steps are executed and they work. However, the autocomplete does not pick up any of these steps.

### ✅ What did you expect to see?

I expect the autocomplete feature of this plugin to identify these compiled step definitions, just like the other plugin does.

### 📦 Which tool/library version are you using?

node v20
cucumber-js v11.0.1
cucumber/vscode v1.10.0

### 🔬 How could we reproduce it?

_No response_

### 📚 Any additional context?

**NOTES:**
- The other cucumber plugin "Cucumber (Gherkin) Full Support" does recognize these steps and provides autocomplete, but I don't want to use that one, I want to use the official plugin (because this one is just better)
- the path in my VS Code settings.json is 100% correct, as it is the same one I use in my cucumber.js and in the other plugin that works.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.