UNPKG

cucumber-steps-parser

Version:

A utility to parse the cucumber steps defined in the corresponding step definition files

33 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); const yargs_1 = require("yargs"); const logic_1 = require("./logic"); const path = yargs_1.argv._[0]; const recursive = yargs_1.argv.recursive !== 'false'; const filenameRegExp = yargs_1.argv.filenameRegExp; if (!path) { console.log(`Usage: cucumber-steps-parser <path> [--recursive <true | false>] [--filenameRegExp <filename_regex>] E.g. cucumber-steps-parser path/to/your/project`); process.exit(1); } else { try { if (!fs_1.existsSync(path)) { console.log(`No directory or file was found at ${path}`); process.exit(1); } const cucumberSteps = fs_1.lstatSync(path).isDirectory() ? logic_1.getFolderCucumberSteps(path, { filenameRegExp, recursive }) : logic_1.getFileCucumberSteps(path); console.log(JSON.stringify(cucumberSteps, null, 4)); } catch (error) { console.log(error); process.exit(1); } } //# sourceMappingURL=cli.js.map