Webstorm은 "TypeScript"파일 유형에 대해 마법사를 제공하지 않는 것 같으므로 수동으로 단계 정의 파일을 작성할 수 있습니다.
Simple Math Example에 대한 가능한 TS 단계 정의 파일은 다음과 같습니다
import * as cucumber from "cucumber";
module.exports = function() {
// Assign this to a typed variable so we have type-safe access
let sd: cucumber.StepDefinitions = this;
// The common variable is simply kept in function scope here
let variable: number = 0;
sd.Given(/^a variable set to (\d+)$/, (value: string) => {
variable = parseInt(value);
});
sd.When(/^I increment the variable by (\d+)$/, (value: string) => {
variable += parseInt(value);
});
sd.Then(/^the variable should contain (\d+)$/, (value: string) => {
if (variable != parseInt(value))
throw new Error('Variable should contain '+value
+ ' but it contains ' + variable + '.');
});
};
는 예를 들어,이 내용을 넣어 features/step_definitions/mathSteps.ts와 같은 파일에 the example의 피쳐 코드를 붙여 넣습니다. features/math.feature를 사용하면 실행중인 예제가 있어야합니다.
'Webstorm이 파일 형식 "TypeScript"섹션에 마법사를 제공하지 않는 것만으로이 대답을 선택합니다. 그게 제가 알고 싶어하는 것입니다. 감사! –
나는 오이를 통해 무엇이든 접근 할 수 없었다. 단계 정의. 오류 : 'StepDefinitions'이'typeof path /to/my/cucumber/@types/index.ts '유형에 없습니다. – user2954463