UNPKG

jest-bdd-generator

Version:

Jest code generator empowered with Gherkin and BDD

64 lines (63 loc) 2.01 kB
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _async_to_generator(fn) { return function() { var self = this, args = arguments; return new Promise(function(resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(void 0); }); }; } import { TestGenerator } from "../gherkin-to-test"; import { run } from "./adapter"; import * as path from "path"; import * as fs from "fs"; function main() { return _main.apply(this, arguments); } function _main() { _main = _async_to_generator(function* () { const files = fs.readdirSync(path.join(process.cwd(), "./tests")); let defaultFileEntry; if (files[0]) { var _files__match; var _files__match_; defaultFileEntry = (_files__match_ = (_files__match = files[0].match(/(\w+)\.test\.ts/)) === null || _files__match === void 0 ? void 0 : _files__match[1]) !== null && _files__match_ !== void 0 ? _files__match_ : "index"; } const generator = new TestGenerator(); function execute(...args) { return generator.generateGherkin(...args); } const options = { pathTestsInput: path.join(process.cwd(), `./tests/${defaultFileEntry}.test.ts`), pathGherkinInput: path.join(process.cwd(), `./docs/features/${defaultFileEntry}.feature`) }; const optionsFromArgV = [ "pathTestsInput", "pathGherkinInput" ]; const stepsKnown = run(execute, options, optionsFromArgV); }); return _main.apply(this, arguments); } void main(); //# sourceMappingURL=gen-test.js.map