UNPKG

gherkin-lint-ts

Version:

Gherkin features linter written in Typescript

30 lines 971 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = exports.name = void 0; exports.name = "no-empty-background"; function run(feature) { var _a; if (!feature) { return []; } const errors = []; (_a = feature.children) === null || _a === void 0 ? void 0 : _a.forEach(child => { var _a, _b; if (child.background) { if (((_b = (_a = child.background) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.length) === 0) { errors.push(createError(child.background)); } } }); return errors; } exports.run = run; function createError(background) { var _a; return { message: "Empty backgrounds are not allowed.", rule: exports.name, line: ((_a = background.location) === null || _a === void 0 ? void 0 : _a.line) || 0, }; } //# sourceMappingURL=no-empty-background.js.map