@dev-blinq/cucumber-js 1.0.37 → 1.0.38-stage
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/download-install.js +167 -0
- package/lib/api/convert_configuration.js +1 -0
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/gherkin.js +47 -1
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +1 -1
- package/lib/api/run_cucumber.js +10 -10
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/types.d.ts +5 -3
- package/lib/api/types.js.map +1 -1
- package/lib/cli/helpers.d.ts +8 -6
- package/lib/cli/helpers.js +27 -6
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/index.js +7 -2
- package/lib/cli/index.js.map +1 -1
- package/lib/configuration/argv_parser.js +4 -2
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/axios_client.d.ts +1 -0
- package/lib/configuration/axios_client.js +40 -0
- package/lib/configuration/axios_client.js.map +1 -0
- package/lib/configuration/default_configuration.js +2 -0
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/types.d.ts +2 -0
- package/lib/configuration/types.js.map +1 -1
- package/lib/formatter/api.d.ts +2 -0
- package/lib/formatter/api.js +53 -0
- package/lib/formatter/api.js.map +1 -0
- package/lib/formatter/bvt_analysis_formatter.d.ts +19 -0
- package/lib/formatter/bvt_analysis_formatter.js +244 -0
- package/lib/formatter/bvt_analysis_formatter.js.map +1 -0
- package/lib/formatter/feature_data_format.d.ts +12 -3
- package/lib/formatter/feature_data_format.js +106 -8
- package/lib/formatter/feature_data_format.js.map +1 -1
- package/lib/formatter/helpers/formatters.js +2 -2
- package/lib/formatter/helpers/formatters.js.map +1 -1
- package/lib/formatter/helpers/report_generator.d.ts +48 -8
- package/lib/formatter/helpers/report_generator.js +127 -4
- package/lib/formatter/helpers/report_generator.js.map +1 -1
- package/lib/formatter/helpers/upload_serivce.d.ts +6 -1
- package/lib/formatter/helpers/upload_serivce.js +142 -17
- package/lib/formatter/helpers/upload_serivce.js.map +1 -1
- package/lib/formatter/helpers/uploader.d.ts +11 -0
- package/lib/formatter/helpers/uploader.js +140 -0
- package/lib/formatter/helpers/uploader.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +7 -2
- package/lib/formatter/bvt_formatter.d.ts +0 -9
- package/lib/formatter/bvt_formatter.js +0 -62
- package/lib/formatter/bvt_formatter.js.map +0 -1
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAA0C;AAI1C,oDAAgD;AAChD,oDAAiD;AAEjD,4CAAmB;AACnB,6DAA8C;AAE9C,8EAA0D;AAK1D,wCAAoC;AAapC;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAA2B,EAAE,EAAE;YAC9D,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;YAC3C,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;gBAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAA;gBAC1B,MAAM,eAAe,GAAG,kBAAkB,CAAC,kBAAkB,CAC3D,MAAM,CAAC,GAAG,CACX,CAAA;gBACD,IA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AAC,EAAE;gBAC7B,IAAI,EAAE,sBAAsB,CAAC,IAAI;gBACjC,aAAa,EAAE,sBAAsB,CAAC,aAAa;gBACnD,eAAe,EAAE,mBAAmB,CAAC,sBAAsB,CAAC;aAC7D;SACF,CAAA;QACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,gBAAgB,CACvB,kBAAuC,EACvC,gBAA8B;IAE9B,CAAC;IAAA,EAAE;SACA,MAAM,CACL,kBAAkB,CAAC,4BAA4B,EAC/C,kBAAkB,CAAC,2BAA2B,CAC/C;SACA,OAAO,CAAC,CAAC,qBAA4C,EAAE,EAAE;QACxD,MAAM,QAAQ,GAAsB;YAClC,IAAI,EAAE;gBACJ,EAAE,EAAE,qBAAqB,CAAC,EAAE;gBAC5B,eAAe,EAAE,mBAAmB,CAAC,qBAAqB,CAAC;aAC5D;SACF,CAAA;QACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { OptionSplitter } from '../configuration'\nimport { Readable } from 'stream'\nimport os from 'os'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { PickleOrder } from '../models/pickle_order'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)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AAG,CAAC;aACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aAC9D,IAAI,CAAC,EAAE,CAAC,CAAA;QACX,uDAAuD;QACvD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAEjD,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AArBD,gCAqBC","sourcesContent":["import detectCiEnvironment from '@cucumber/ci-environment'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport shuffle from 'knuth-shuffle-seeded'\nimport os from 'os'\nimport { Readable } from 'stream'\nimport { IConfiguration, OptionSplitter } from '../configuration'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ILogger } from '../logger'\nimport { PickleOrder } from '../models/pickle_order'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport PickleFilter from '../pickle_filter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { ILineAndUri } from '../types'\nimport { doesHaveValue } from '../value_checker'\nimport { version } from '../version'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\ninterface MetaMessage extends messages.Meta {\n runName?: string\n}\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv,\n runName?: string\n): Promise<void> {\n const meta: MetaMessage = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n runName,\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n\nexport function getRunName(argvConfiguration: Partial<IConfiguration>): string {\n if (doesHaveValue(argvConfiguration.runName)) {\n return argvConfiguration.runName\n }\n if (\n doesHaveValue(argvConfiguration.name && argvConfiguration.name.length > 0)\n ) {\n return argvConfiguration.name[0]\n }\n if (doesHaveValue(argvConfiguration.tags)) {\n //replace word \"and\" with & and \"or\" with |\n let tags = argvConfiguration.tags\n .split(' ')\n .map((tag) => (tag === 'and' ? '&' : tag === 'or' ? '|' : tag))\n .join('')\n //remove the starting and ending paranthesis if present\n tags = tags.replace(/^\\(/, '').replace(/\\)$/, '')\n\n return tags\n }\n return ''\n}\n"]}
|
package/lib/cli/index.js
CHANGED
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const debug_1 = __importDefault(require("debug"));
|
|
7
7
|
const api_1 = require("../api");
|
|
8
|
+
const configuration_1 = require("../configuration");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
8
10
|
const i18n_1 = require("./i18n");
|
|
9
11
|
const install_validator_1 = require("./install_validator");
|
|
10
|
-
const debug_1 = __importDefault(require("debug"));
|
|
11
12
|
class Cli {
|
|
12
13
|
constructor({ argv, cwd, stdout, stderr = process.stderr, env, }) {
|
|
13
14
|
this.argv = argv;
|
|
@@ -22,6 +23,10 @@ class Cli {
|
|
|
22
23
|
await (0, install_validator_1.validateInstall)();
|
|
23
24
|
}
|
|
24
25
|
const { options, configuration: argvConfiguration } = configuration_1.ArgvParser.parse(this.argv);
|
|
26
|
+
argvConfiguration.runName = (0, helpers_1.getRunName)(argvConfiguration);
|
|
27
|
+
if (argvConfiguration.bvtRerun) {
|
|
28
|
+
process.env.BVT_FORMATTER = 'ANALYSIS';
|
|
29
|
+
}
|
|
25
30
|
if (options.i18nLanguages) {
|
|
26
31
|
this.stdout.write((0, i18n_1.getLanguages)());
|
|
27
32
|
return {
|
package/lib/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,gCAAuD;AACvD,oDAA6C;AAE7C,uCAAsC;AACtC,iCAAkD;AAClD,2DAAqD;AAOrD,MAAqB,GAAG;IAOtB,YAAY,EACV,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,GAOJ;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,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,gBAAgB,EAAE,GACzD,MAAM,IAAA,uBAAiB,EACrB;YACE,IAAI,EAAE,OAAO,CAAC,MAAM;YACpB,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,QAAQ,EAAE,iBAAiB;SAC5B,EACD,WAAW,CACZ,CAAA;QACH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,iBAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;QACpE,OAAO;YACL,qBAAqB,EAAE,aAAa,CAAC,SAAS;YAC9C,OAAO;SACR,CAAA;IACH,CAAC;CACF;AA5ED,sBA4EC","sourcesContent":["import debug from 'debug'\nimport { loadConfiguration, runCucumber } from '../api'\nimport { ArgvParser } from '../configuration'\nimport { IFormatterStream } from '../formatter'\nimport { getRunName } from './helpers'\nimport { getKeywords, getLanguages } from './i18n'\nimport { validateInstall } from './install_validator'\n\nexport interface ICliRunResult {\n shouldExitImmediately: boolean\n success: boolean\n}\n\nexport default class Cli {\n private readonly argv: string[]\n private readonly cwd: string\n private readonly stdout: IFormatterStream\n private readonly stderr: IFormatterStream\n private readonly env: NodeJS.ProcessEnv\n\n constructor({\n argv,\n cwd,\n stdout,\n stderr = process.stderr,\n env,\n }: {\n argv: string[]\n cwd: string\n stdout: IFormatterStream\n stderr?: IFormatterStream\n env: NodeJS.ProcessEnv\n }) {\n this.argv = argv\n this.cwd = cwd\n this.stdout = stdout\n this.stderr = stderr\n this.env = env\n }\n\n async run(): Promise<ICliRunResult> {\n const debugEnabled = debug.enabled('cucumber')\n if (debugEnabled) {\n await validateInstall()\n }\n const { options, configuration: argvConfiguration } = ArgvParser.parse(\n this.argv\n )\n argvConfiguration.runName = getRunName(argvConfiguration)\n if (argvConfiguration.bvtRerun) {\n process.env.BVT_FORMATTER = 'ANALYSIS'\n }\n if (options.i18nLanguages) {\n this.stdout.write(getLanguages())\n return {\n shouldExitImmediately: true,\n success: true,\n }\n }\n if (options.i18nKeywords) {\n this.stdout.write(getKeywords(options.i18nKeywords))\n return {\n shouldExitImmediately: true,\n success: true,\n }\n }\n\n const environment = {\n cwd: this.cwd,\n stdout: this.stdout,\n stderr: this.stderr,\n env: this.env,\n debug: debugEnabled,\n }\n const { useConfiguration: configuration, runConfiguration } =\n await loadConfiguration(\n {\n file: options.config,\n profiles: options.profile,\n provided: argvConfiguration,\n },\n environment\n )\n const { success } = await runCucumber(runConfiguration, environment)\n return {\n shouldExitImmediately: configuration.forceExit,\n success,\n }\n }\n}\n"]}
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const gherkin_1 = require("@cucumber/gherkin");
|
|
6
7
|
const commander_1 = require("commander");
|
|
7
8
|
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
-
const gherkin_1 = require("@cucumber/gherkin");
|
|
9
9
|
const formatters_1 = __importDefault(require("../formatter/helpers/formatters"));
|
|
10
10
|
const version_1 = require("../version");
|
|
11
11
|
const ArgvParser = {
|
|
@@ -79,7 +79,9 @@ const ArgvParser = {
|
|
|
79
79
|
.option('--strict', 'fail if there are pending steps')
|
|
80
80
|
.option('--no-strict', 'succeed even if there are pending steps')
|
|
81
81
|
.option('-t, --tags <EXPRESSION>', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags)
|
|
82
|
-
.option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'))
|
|
82
|
+
.option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'))
|
|
83
|
+
.option('--run-name <NAME>', 'provide a name for the run')
|
|
84
|
+
.option('--bvt-rerun', 'rerun failed scenarios from the last run');
|
|
83
85
|
program.addHelpText('afterAll', 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md');
|
|
84
86
|
program.parse(argv);
|
|
85
87
|
const { config, i18nKeywords, i18nLanguages, profile, ...regularStuff } = program.opts();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,iFAAwD;AACxD,wCAAoC;AAkBpC,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;SACtB;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC7C,IAAI,GAAW,CAAA;YACf,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACtB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,GAAU,KAAK,CAAA;gBACtB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAA;aACvE;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,sCAAsC,GAAG,EAAE,CAAC,CAAA;aACtE;YACD,OAAO,IAAA,sBAAK,EAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACzB,CAAC,CAAA;IACH,CAAC;IAED,SAAS,CAAC,KAAa,EAAE,IAAa;QACpC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAA;IACvD,CAAC;IAED,mBAAmB,CAAC,KAAa,E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M,EACJ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,GAAG,YAAY,EAChB,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Formatters.buildFormattersDocumentationString(),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\"\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
1
|
+
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,+CAA4C;AAC5C,yCAAmC;AACnC,gEAAgC;AAChC,iFAAwD;AACxD,wCAAoC;AAkBpC,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;SACtB;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc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;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { dialects } from '@cucumber/gherkin'\nimport { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Formatters.buildFormattersDocumentationString(),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\"\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n .option('--run-name <NAME>', 'provide a name for the run')\n .option('--bvt-rerun', 'rerun failed scenarios from the last run')\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const axiosClient: import("axios").AxiosInstance;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.axiosClient = void 0;
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const tunnel_1 = __importDefault(require("tunnel"));
|
|
10
|
+
const getProxy = () => {
|
|
11
|
+
if (!process.env.PROXY) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const proxy = process.env.PROXY;
|
|
15
|
+
const url = new URL(proxy);
|
|
16
|
+
const proxyObject = {
|
|
17
|
+
host: url.hostname,
|
|
18
|
+
port: Number(url.port),
|
|
19
|
+
};
|
|
20
|
+
const { username, password } = url;
|
|
21
|
+
if (username && password) {
|
|
22
|
+
proxyObject.proxyAuth = `${username}:${password}`;
|
|
23
|
+
}
|
|
24
|
+
return tunnel_1.default.httpsOverHttp({ proxy: proxyObject });
|
|
25
|
+
};
|
|
26
|
+
const createAxiosClient = () => {
|
|
27
|
+
try {
|
|
28
|
+
const agent = getProxy();
|
|
29
|
+
return axios_1.default.create({
|
|
30
|
+
httpsAgent: agent,
|
|
31
|
+
proxy: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.log(error.message);
|
|
36
|
+
throw new Error(`Error creating axios client ${error instanceof Error ? error.message : error.response.data}`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.axiosClient = createAxiosClient();
|
|
40
|
+
//# sourceMappingURL=axios_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios_client.js","sourceRoot":"","sources":["../../src/configuration/axios_client.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAC/B,kDAAyB;AACzB,oDAA6C;AAG7C,MAAM,QAAQ,GAAG,GAAiB,EAAE;IAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACtB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,KAAK,GAAkB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,WAAW,GAAiB;QAChC,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KACvB,CAAA;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;IAElC,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,WAAW,CAAC,SAAS,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAA;KAClD;IACD,OAAO,gBAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,IAAI;QACF,MAAM,KAAK,GAAmB,QAAQ,EAAE,CAAA;QACxC,OAAO,eAAK,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE,KAAK;YACjB,KAAK,EAAE,KAAK;SACb,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC1B,MAAM,IAAI,KAAK,CACb,+BACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAC1D,EAAE,CACH,CAAA;KACF;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,iBAAiB,EAAE,CAAA","sourcesContent":["/* eslint-disable no-console */\nimport axios from 'axios'\nimport tunnel, { ProxyOptions } from 'tunnel'\nimport { Agent } from 'http'\n\nconst getProxy = (): Agent | null => {\n if (!process.env.PROXY) {\n return null\n }\n\n const proxy: string | null = process.env.PROXY\n const url = new URL(proxy)\n const proxyObject: ProxyOptions = {\n host: url.hostname,\n port: Number(url.port),\n }\n\n const { username, password } = url\n\n if (username && password) {\n proxyObject.proxyAuth = `${username}:${password}`\n }\n return tunnel.httpsOverHttp({ proxy: proxyObject })\n}\n\nconst createAxiosClient = () => {\n try {\n const agent: string | Agent = getProxy()\n return axios.create({\n httpsAgent: agent,\n proxy: false,\n })\n } catch (error) {\n console.log(error.message)\n throw new Error(\n `Error creating axios client ${\n error instanceof Error ? error.message : error.response.data\n }`\n )\n }\n}\n\nexport const axiosClient = createAxiosClient()\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;IACnB,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,KAAK;CAChB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n publishQuiet: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n strict: true,\n tags: '',\n worldParameters: {},\n runName: '',\n bvtRerun: false,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormatOptions } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\n\nexport interface IConfiguration {\n backtrace: boolean\n dryRun: boolean\n forceExit: boolean\n failFast: boolean\n format: string[]\n formatOptions: FormatOptions\n import: string[]\n language: string\n name: string[]\n order: PickleOrder\n paths: string[]\n parallel: number\n publish: boolean\n /**\n * @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\n publishQuiet: boolean\n require: string[]\n requireModule: string[]\n retry: number\n retryTagFilter: string\n strict: boolean\n tags: string\n worldParameters: any\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormatOptions } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\n\nexport interface IConfiguration {\n backtrace: boolean\n dryRun: boolean\n forceExit: boolean\n failFast: boolean\n format: string[]\n formatOptions: FormatOptions\n import: string[]\n language: string\n name: string[]\n order: PickleOrder\n paths: string[]\n parallel: number\n publish: boolean\n /**\n * @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\n publishQuiet: boolean\n require: string[]\n requireModule: string[]\n retry: number\n retryTagFilter: string\n strict: boolean\n tags: string\n worldParameters: any\n runName: string\n bvtRerun: boolean\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProjectByAccessKey = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const tunnel_1 = __importDefault(require("tunnel"));
|
|
9
|
+
const getSSoUrl = () => {
|
|
10
|
+
switch (process.env.NODE_ENV_BLINQ) {
|
|
11
|
+
case 'local':
|
|
12
|
+
return 'http://localhost:5000/api/auth';
|
|
13
|
+
case 'dev':
|
|
14
|
+
return 'https://dev.api.blinq.io/api/auth';
|
|
15
|
+
case 'stage':
|
|
16
|
+
return 'https://stage.api.blinq.io/api/auth';
|
|
17
|
+
default:
|
|
18
|
+
return 'https://api.blinq.io/api/auth';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const getProxy = () => {
|
|
22
|
+
if (!process.env.PROXY) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const proxy = process.env.PROXY;
|
|
26
|
+
const url = new URL(proxy);
|
|
27
|
+
const proxyObject = {
|
|
28
|
+
host: url.hostname,
|
|
29
|
+
port: Number(url.port),
|
|
30
|
+
};
|
|
31
|
+
const { username, password } = url;
|
|
32
|
+
if (username && password) {
|
|
33
|
+
//@ts-ignore
|
|
34
|
+
proxyObject.proxyAuth = `${username}:${password}`;
|
|
35
|
+
}
|
|
36
|
+
return tunnel_1.default.httpsOverHttp({ proxy: proxyObject });
|
|
37
|
+
};
|
|
38
|
+
const getProjectByAccessKey = async (access_key) => {
|
|
39
|
+
const ssoUrl = getSSoUrl();
|
|
40
|
+
const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`;
|
|
41
|
+
const response = await axios_1.default.post(accessKeyUrl, {
|
|
42
|
+
access_key,
|
|
43
|
+
httpAgent: getProxy(),
|
|
44
|
+
proxy: false,
|
|
45
|
+
});
|
|
46
|
+
if (response.status !== 200) {
|
|
47
|
+
console.error('Error: Invalid access key');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
return response.data;
|
|
51
|
+
};
|
|
52
|
+
exports.getProjectByAccessKey = getProjectByAccessKey;
|
|
53
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/formatter/api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,oDAA2B;AAE3B,MAAM,SAAS,GAAG,GAAG,EAAE;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAClC,KAAK,OAAO;YACV,OAAO,gCAAgC,CAAA;QACzC,KAAK,KAAK;YACR,OAAO,mCAAmC,CAAA;QAC5C,KAAK,OAAO;YACV,OAAO,qCAAqC,CAAA;QAC9C;YACE,OAAO,+BAA+B,CAAA;KACzC;AACH,CAAC,CAAA;AACD,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACtB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,WAAW,GAAG;QAClB,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KACvB,CAAA;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;IAElC,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,YAAY;QACZ,WAAW,CAAC,SAAS,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAA;KAClD;IACD,OAAO,gBAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAiB,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,YAAY,GAAG,GAAG,MAAM,wBAAwB,CAAA;IACtD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE;QAC9C,UAAU;QACV,SAAS,EAAE,QAAQ,EAAE;QACrB,KAAK,EAAE,KAAK;KACb,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IACD,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC,CAAC;AAEO,sDAAqB","sourcesContent":["import axios from 'axios'\nimport tunnel from 'tunnel'\n\nconst getSSoUrl = () => {\n switch (process.env.NODE_ENV_BLINQ) {\n case 'local':\n return 'http://localhost:5000/api/auth'\n case 'dev':\n return 'https://dev.api.blinq.io/api/auth'\n case 'stage':\n return 'https://stage.api.blinq.io/api/auth'\n default:\n return 'https://api.blinq.io/api/auth'\n }\n }\n const getProxy = () => {\n if (!process.env.PROXY) {\n return null\n }\n \n const proxy = process.env.PROXY\n const url = new URL(proxy)\n const proxyObject = {\n host: url.hostname,\n port: Number(url.port),\n }\n \n const { username, password } = url\n \n if (username && password) {\n //@ts-ignore\n proxyObject.proxyAuth = `${username}:${password}`\n }\n return tunnel.httpsOverHttp({ proxy: proxyObject })\n }\n \n const getProjectByAccessKey = async (access_key:string) => {\n const ssoUrl = getSSoUrl()\n const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`\n const response = await axios.post(accessKeyUrl, {\n access_key,\n httpAgent: getProxy(),\n proxy: false,\n })\n if (response.status !== 200) {\n console.error('Error: Invalid access key')\n process.exit(1)\n }\n return response.data\n };\n\n export { getProjectByAccessKey };"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Formatter, { IFormatterOptions } from '.';
|
|
2
|
+
export default class BVTAnalysisFormatter extends Formatter {
|
|
3
|
+
private reportGenerator;
|
|
4
|
+
private uploader;
|
|
5
|
+
private exit;
|
|
6
|
+
private START;
|
|
7
|
+
private runName;
|
|
8
|
+
constructor(options: IFormatterOptions);
|
|
9
|
+
private uploadReport;
|
|
10
|
+
finished(): Promise<any>;
|
|
11
|
+
private analyzeReport;
|
|
12
|
+
private processTestCases;
|
|
13
|
+
private processTestCase;
|
|
14
|
+
private uploadFinalReport;
|
|
15
|
+
private retrain;
|
|
16
|
+
private call_cucumber_client;
|
|
17
|
+
private getAppDataDir;
|
|
18
|
+
}
|
|
19
|
+
export declare function logReportLink(runId: string, projectId: string): void;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logReportLink = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const promises_1 = require("fs/promises");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const tmp_1 = require("tmp");
|
|
12
|
+
const _1 = __importDefault(require("."));
|
|
13
|
+
const value_checker_1 = require("../value_checker");
|
|
14
|
+
const report_generator_1 = __importDefault(require("./helpers/report_generator"));
|
|
15
|
+
const uploader_1 = __importDefault(require("./helpers/uploader"));
|
|
16
|
+
const os_1 = __importDefault(require("os"));
|
|
17
|
+
const api_1 = require("./api");
|
|
18
|
+
//User token
|
|
19
|
+
const TOKEN = process.env.TOKEN;
|
|
20
|
+
class BVTAnalysisFormatter extends _1.default {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
super(options);
|
|
23
|
+
this.reportGenerator = new report_generator_1.default();
|
|
24
|
+
this.uploader = new uploader_1.default(this.reportGenerator);
|
|
25
|
+
this.exit = false;
|
|
26
|
+
if (!TOKEN && process.env.BVT_FORMATTER === 'ANALYSIS') {
|
|
27
|
+
throw new Error('TOKEN must be set');
|
|
28
|
+
}
|
|
29
|
+
options.eventBroadcaster.on('envelope', async (envelope) => {
|
|
30
|
+
await this.reportGenerator.handleMessage(envelope);
|
|
31
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.meta) &&
|
|
32
|
+
(0, value_checker_1.doesHaveValue)(envelope.meta.runName)) {
|
|
33
|
+
this.runName = envelope.meta.runName;
|
|
34
|
+
}
|
|
35
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
36
|
+
const report = this.reportGenerator.getReport();
|
|
37
|
+
this.START = Date.now();
|
|
38
|
+
if (process.env.BVT_FORMATTER === 'ANALYSIS') {
|
|
39
|
+
await this.analyzeReport(report);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// await this.uploadReport(report)
|
|
43
|
+
}
|
|
44
|
+
this.exit = true;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async uploadReport(report) {
|
|
49
|
+
const uploadSuccessful = await this.uploadFinalReport(report);
|
|
50
|
+
if (uploadSuccessful && report.result.status !== 'FAILED') {
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
async finished() {
|
|
56
|
+
await new Promise((resolve) => {
|
|
57
|
+
const checkInterval = setInterval(() => {
|
|
58
|
+
if (this.exit) {
|
|
59
|
+
clearInterval(checkInterval);
|
|
60
|
+
resolve(null);
|
|
61
|
+
}
|
|
62
|
+
}, 100); // check every 100ms
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async analyzeReport(report) {
|
|
66
|
+
if (report.result.status === 'PASSED' ||
|
|
67
|
+
process.env.NO_RETRAIN === 'false') {
|
|
68
|
+
if (report.result.status === 'PASSED') {
|
|
69
|
+
this.log('No test failed. No need to retrain\n');
|
|
70
|
+
}
|
|
71
|
+
if (process.env.NO_RETRAIN === 'false') {
|
|
72
|
+
this.log('Retraining is skipped since the failed step contains an API request\n');
|
|
73
|
+
}
|
|
74
|
+
// const uploadSuccessful = await this.uploadFinalReport(report)
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
//checking if the type of report.result is JsonResultFailed or not
|
|
78
|
+
this.log('Some tests failed, starting the retraining...\n');
|
|
79
|
+
if (!('startTime' in report.result) || !('endTime' in report.result)) {
|
|
80
|
+
this.log('Unknown error occured,not retraining\n');
|
|
81
|
+
await this.uploadFinalReport(report);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const finalReport = await this.processTestCases(report);
|
|
85
|
+
const uploadSuccessful = await this.uploadFinalReport(finalReport);
|
|
86
|
+
if (finalReport.result.status !== 'FAILED' && uploadSuccessful) {
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async processTestCases(report) {
|
|
94
|
+
const finalTestCases = [];
|
|
95
|
+
for (const testCase of report.testCases) {
|
|
96
|
+
const modifiedTestCase = await this.processTestCase(testCase, report);
|
|
97
|
+
finalTestCases.push(modifiedTestCase);
|
|
98
|
+
}
|
|
99
|
+
const finalResult = finalTestCases.some((tc) => tc.result.status !== 'PASSED')
|
|
100
|
+
? report.result
|
|
101
|
+
: {
|
|
102
|
+
...report.result,
|
|
103
|
+
status: 'PASSED',
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
result: finalResult,
|
|
107
|
+
testCases: finalTestCases,
|
|
108
|
+
env: report.env,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async processTestCase(testCase, report) {
|
|
112
|
+
if (testCase.result.status === 'PASSED') {
|
|
113
|
+
return testCase;
|
|
114
|
+
}
|
|
115
|
+
const failedTestSteps = testCase.steps
|
|
116
|
+
.map((step, i) => (step.result.status === 'FAILED' ? i : null))
|
|
117
|
+
.filter((i) => i !== null);
|
|
118
|
+
const retrainStats = await this.retrain(failedTestSteps, testCase);
|
|
119
|
+
if (!retrainStats) {
|
|
120
|
+
return testCase;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
...testCase,
|
|
124
|
+
retrainStats,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async uploadFinalReport(finalReport) {
|
|
128
|
+
let success = true;
|
|
129
|
+
try {
|
|
130
|
+
const { projectId, runId } = await this.uploader.uploadRun(finalReport, this.runName);
|
|
131
|
+
logReportLink(runId, projectId);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
this.log('Error uploading report\n');
|
|
135
|
+
if ('stack' in err) {
|
|
136
|
+
this.log(err.stack);
|
|
137
|
+
}
|
|
138
|
+
success = false;
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
try {
|
|
142
|
+
(0, fs_1.writeFileSync)(path_1.default.join(this.reportGenerator.reportFolder, 'report.json'), JSON.stringify(finalReport, null, 2), 'utf-8');
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
console.error('failed to write report.json to local disk');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//this.log(JSON.stringify(finalReport, null, 2))
|
|
149
|
+
return success;
|
|
150
|
+
}
|
|
151
|
+
async retrain(failedTestCases, testCase) {
|
|
152
|
+
const data = await (0, api_1.getProjectByAccessKey)(TOKEN);
|
|
153
|
+
const currentTimestampInSeconds = Math.floor(Date.now() / 1000);
|
|
154
|
+
if (data.project.expriration_date < currentTimestampInSeconds) {
|
|
155
|
+
console.log('Warning: Your project has expired, retraining is restricted. Please contact sales.');
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
return await this.call_cucumber_client(failedTestCases, testCase);
|
|
159
|
+
}
|
|
160
|
+
async call_cucumber_client(stepsToRetrain, testCase) {
|
|
161
|
+
return new Promise((resolve, reject) => {
|
|
162
|
+
const cucumber_client_path = path_1.default.resolve(process.cwd(), 'node_modules', '@dev-blinq', 'cucumber_client', 'bin', 'client', 'cucumber.js');
|
|
163
|
+
const args = [
|
|
164
|
+
process.cwd(),
|
|
165
|
+
path_1.default.join(process.cwd(), testCase.uri),
|
|
166
|
+
`${testCase.scenarioName}`,
|
|
167
|
+
'undefined',
|
|
168
|
+
`${stepsToRetrain.join(',')}`,
|
|
169
|
+
];
|
|
170
|
+
if (process.env.BLINQ_ENV) {
|
|
171
|
+
args.push(`--env=${process.env.BLINQ_ENV}`);
|
|
172
|
+
}
|
|
173
|
+
if (!(0, fs_1.existsSync)(path_1.default.join(this.getAppDataDir(), 'blinq.io', '.temp'))) {
|
|
174
|
+
(0, promises_1.mkdir)(path_1.default.join(this.getAppDataDir(), 'blinq.io', '.temp'), {
|
|
175
|
+
recursive: true,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
(0, tmp_1.tmpName)(async (err, name) => {
|
|
179
|
+
const tempFile = path_1.default.join(this.getAppDataDir(), 'blinq.io', '.temp', path_1.default.basename(name));
|
|
180
|
+
console.log('File path: ', tempFile);
|
|
181
|
+
await (0, promises_1.writeFile)(tempFile, '', 'utf-8');
|
|
182
|
+
args.push(`--temp-file=${tempFile}`);
|
|
183
|
+
const cucumberClient = (0, child_process_1.spawn)('node', [cucumber_client_path, ...args], {
|
|
184
|
+
env: {
|
|
185
|
+
...process.env,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
cucumberClient.stdout.on('data', (data) => {
|
|
189
|
+
console.log(data.toString());
|
|
190
|
+
});
|
|
191
|
+
cucumberClient.stderr.on('data', (data) => {
|
|
192
|
+
console.error(data.toString());
|
|
193
|
+
});
|
|
194
|
+
cucumberClient.on('close', async (code) => {
|
|
195
|
+
if (code === 0) {
|
|
196
|
+
const reportData = (0, fs_1.readFileSync)(tempFile, 'utf-8');
|
|
197
|
+
const retrainStats = JSON.parse(reportData);
|
|
198
|
+
await (0, promises_1.unlink)(tempFile);
|
|
199
|
+
resolve(retrainStats);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.log('Error retraining\n');
|
|
203
|
+
resolve(null);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
getAppDataDir() {
|
|
210
|
+
if (process.env.BLINQ_APPDATA_DIR) {
|
|
211
|
+
return process.env.BLINQ_APPDATA_DIR;
|
|
212
|
+
}
|
|
213
|
+
let appDataDir;
|
|
214
|
+
switch (process.platform) {
|
|
215
|
+
case 'win32':
|
|
216
|
+
appDataDir = process.env.APPDATA;
|
|
217
|
+
break;
|
|
218
|
+
case 'darwin':
|
|
219
|
+
appDataDir = path_1.default.join(os_1.default.homedir(), 'Library', 'Application Support');
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
appDataDir = path_1.default.join(os_1.default.homedir(), '.config');
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
return appDataDir;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.default = BVTAnalysisFormatter;
|
|
229
|
+
function logReportLink(runId, projectId) {
|
|
230
|
+
let reportLinkBaseUrl = 'https://app.blinq.io';
|
|
231
|
+
if (process.env.NODE_ENV_BLINQ === 'local') {
|
|
232
|
+
reportLinkBaseUrl = 'http://localhost:3000';
|
|
233
|
+
}
|
|
234
|
+
else if (process.env.NODE_ENV_BLINQ === 'dev') {
|
|
235
|
+
reportLinkBaseUrl = 'https://dev.app.blinq.io';
|
|
236
|
+
}
|
|
237
|
+
else if (process.env.NODE_ENV_BLINQ === 'stage') {
|
|
238
|
+
reportLinkBaseUrl = 'https://stage.app.blinq.io';
|
|
239
|
+
}
|
|
240
|
+
const reportLink = `${reportLinkBaseUrl}/${projectId}/run-report/${runId}`;
|
|
241
|
+
console.log(`Report link: ${reportLink}\n`);
|
|
242
|
+
}
|
|
243
|
+
exports.logReportLink = logReportLink;
|
|
244
|
+
//# sourceMappingURL=bvt_analysis_formatter.js.map
|