@cucumber/cucumber 7.3.2 → 8.0.0-rc.1
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/README.md +11 -4
- package/lib/cli/argv_parser.d.ts +1 -2
- package/lib/cli/argv_parser.js +8 -12
- package/lib/cli/argv_parser.js.map +1 -1
- package/lib/cli/configuration_builder.d.ts +0 -1
- package/lib/cli/configuration_builder.js +18 -20
- package/lib/cli/configuration_builder.js.map +1 -1
- package/lib/cli/helpers.d.ts +1 -0
- package/lib/cli/helpers.js +9 -4
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +6 -6
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +18 -20
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/profile_loader.d.ts +3 -2
- package/lib/cli/profile_loader.js +17 -10
- package/lib/cli/profile_loader.js.map +1 -1
- package/lib/formatter/builder.d.ts +5 -4
- package/lib/formatter/builder.js +38 -52
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
- package/lib/formatter/helpers/event_data_collector.js +6 -5
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +41 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +24 -37
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +4 -5
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -5
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +8 -17
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +7 -6
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +4 -7
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +21 -35
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.d.ts +1 -0
- package/lib/formatter/html_formatter.js +1 -0
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +1 -1
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +1 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -0
- package/lib/formatter/json_formatter.js +12 -7
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.d.ts +1 -0
- package/lib/formatter/message_formatter.js +1 -0
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -0
- package/lib/formatter/progress_bar_formatter.js +2 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -0
- package/lib/formatter/progress_formatter.js +1 -0
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +11 -7
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +1 -0
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -0
- package/lib/formatter/summary_formatter.js +4 -4
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +3 -3
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.d.ts +1 -0
- package/lib/formatter/usage_json_formatter.js +1 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +9 -7
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/step_definition.js +1 -2
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +5 -5
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +2 -2
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -0
- package/lib/runtime/helpers.js +36 -1
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +0 -2
- package/lib/runtime/index.js +7 -41
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +0 -1
- package/lib/runtime/parallel/coordinator.js +11 -15
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.js +15 -7
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/step_runner.js +1 -3
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -3
- package/lib/runtime/test_case_runner.js +13 -22
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +4 -5
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/support_code_library_builder/build_helpers.js +14 -10
- package/lib/support_code_library_builder/build_helpers.js.map +1 -1
- package/lib/support_code_library_builder/index.js +0 -15
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +14 -19
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +1 -0
- package/lib/time.js +17 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +7 -14
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.d.ts +2 -2
- package/lib/value_checker.js.map +1 -1
- package/lib/wrapper.mjs +38 -0
- package/package.json +71 -63
- package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
- package/lib/support_code_library_builder/finalize_helpers.js +0 -26
- package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
|
@@ -3,7 +3,6 @@ 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 lodash_1 = __importDefault(require("lodash"));
|
|
7
6
|
const helpers_1 = require("./helpers");
|
|
8
7
|
const _1 = __importDefault(require("./"));
|
|
9
8
|
const value_checker_1 = require("../value_checker");
|
|
@@ -27,11 +26,11 @@ class SummaryFormatter extends _1.default {
|
|
|
27
26
|
const failures = [];
|
|
28
27
|
const warnings = [];
|
|
29
28
|
const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts();
|
|
30
|
-
|
|
31
|
-
if (helpers_1.isFailure(testCaseAttempt.worstTestStepResult)) {
|
|
29
|
+
testCaseAttempts.forEach((testCaseAttempt) => {
|
|
30
|
+
if (helpers_1.isFailure(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
|
|
32
31
|
failures.push(testCaseAttempt);
|
|
33
32
|
}
|
|
34
|
-
else if (helpers_1.isWarning(testCaseAttempt.worstTestStepResult)) {
|
|
33
|
+
else if (helpers_1.isWarning(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
|
|
35
34
|
warnings.push(testCaseAttempt);
|
|
36
35
|
}
|
|
37
36
|
});
|
|
@@ -65,4 +64,5 @@ class SummaryFormatter extends _1.default {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
exports.default = SummaryFormatter;
|
|
67
|
+
SummaryFormatter.documentation = 'Summary output of feature and scenarios';
|
|
68
68
|
//# sourceMappingURL=summary_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,2DAAuE;AACvE,kCAAmD;AAOnD,MAAqB,gBAAiB,SAAQ,UAAS;IAIrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,uBAA2C,CAAA;QAC/C,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,6BAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAC1C,uBAAuB,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAA;aAC5D;YACD,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,MAAM,wBAAwB,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAA;gBACnE,IAAI,CAAC,UAAU,CACb,gCAAyB,CACvB,uBAAuB,EACvB,wBAAwB,CACzB,CACF,CAAA;aACF;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,UAAU,CAAC,eAAkC;QAC3C,MAAM,QAAQ,GAAuB,EAAE,CAAA;QACvC,MAAM,QAAQ,GAAuB,EAAE,CAAA;QACvC,MAAM,gBAAgB,GAAG,IAAI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C;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAhFH,mCAiFC;AAhFwB,8BAAa,GAClC,yCAAyC,CAAA","sourcesContent":["import { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n public static readonly documentation: string =\n 'Summary output of feature and scenarios'\n\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n testCaseAttempts.forEach((testCaseAttempt) => {\n if (\n isFailure(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n failures.push(testCaseAttempt)\n } else if (\n isWarning(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n })\n }\n}\n"]}
|
|
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
26
25
|
const helpers_1 = require("./helpers");
|
|
27
26
|
const _1 = __importDefault(require("./"));
|
|
28
27
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
@@ -73,10 +72,10 @@ class UsageFormatter extends _1.default {
|
|
|
73
72
|
col2.push('UNUSED');
|
|
74
73
|
}
|
|
75
74
|
const col3 = [helpers_1.formatLocation({ line, uri })];
|
|
76
|
-
|
|
75
|
+
matches.slice(0, 5).forEach((match) => {
|
|
77
76
|
col1.push(` ${match.text}`);
|
|
78
77
|
if (value_checker_1.doesHaveValue(match.duration)) {
|
|
79
|
-
col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).
|
|
78
|
+
col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).toFixed(2)}ms`);
|
|
80
79
|
}
|
|
81
80
|
else {
|
|
82
81
|
col2.push('-');
|
|
@@ -92,4 +91,5 @@ class UsageFormatter extends _1.default {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
exports.default = UsageFormatter;
|
|
94
|
+
UsageFormatter.documentation = 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.';
|
|
95
95
|
//# sourceMappingURL=usage_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,qBAAqB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KAAK,CAAC,QAAQ,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CACP,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAC/C,KAAK,CAAC,QAAQ,CACf,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CACjB,CAAA;iBACF;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;iBACf;gBACD,IAAI,CAAC,IAAI,CAAC,wBAAc,CAAC,KAAK,CAAC,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;aACvD;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;;AAxEH,iCAyEC;AAxEwB,4BAAa,GAClC,6MAA6M,CAAA","sourcesContent":["import { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
|
|
@@ -31,4 +31,5 @@ class UsageJsonFormatter extends _1.default {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.default = UsageJsonFormatter;
|
|
34
|
+
UsageJsonFormatter.documentation = 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.';
|
|
34
35
|
//# sourceMappingURL=usage_json_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;
|
|
1
|
+
{"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AA3BH,qCA4BC;AA3BwB,gCAAa,GAClC,uHAAuH,CAAA","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
|
package/lib/importer.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides the async `import()` function to source code that needs it,
|
|
3
|
+
* without having it transpiled down to commonjs `require()` by TypeScript.
|
|
4
|
+
* See https://github.com/microsoft/TypeScript/issues/43329.
|
|
5
|
+
*
|
|
6
|
+
* @param {any} descriptor - A URL or path for the module to load
|
|
7
|
+
* @return {Promise<any>} Promise that resolves to the loaded module
|
|
8
|
+
*/
|
|
9
|
+
async function importer(descriptor) {
|
|
10
|
+
return await import(descriptor)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = { importer }
|
package/lib/index.d.ts
CHANGED
|
@@ -33,3 +33,4 @@ export declare const When: (<WorldType = import("./support_code_library_builder/
|
|
|
33
33
|
export { default as World, IWorld, IWorldOptions, } from './support_code_library_builder/world';
|
|
34
34
|
export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
|
|
35
35
|
export declare const Status: typeof messages.TestStepResultStatus;
|
|
36
|
+
export { wrapPromiseWithTimeout } from './time';
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
|
|
25
|
+
exports.wrapPromiseWithTimeout = exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
|
|
26
26
|
const formatterHelpers = __importStar(require("./formatter/helpers"));
|
|
27
27
|
exports.formatterHelpers = formatterHelpers;
|
|
28
28
|
const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
|
|
@@ -78,4 +78,7 @@ exports.When = methods.When;
|
|
|
78
78
|
var world_1 = require("./support_code_library_builder/world");
|
|
79
79
|
Object.defineProperty(exports, "World", { enumerable: true, get: function () { return __importDefault(world_1).default; } });
|
|
80
80
|
exports.Status = messages.TestStepResultStatus;
|
|
81
|
+
// Time helpers
|
|
82
|
+
var time_1 = require("./time");
|
|
83
|
+
Object.defineProperty(exports, "wrapPromiseWithTimeout", { enumerable: true, get: function () { return time_1.wrapPromiseWithTimeout; } });
|
|
81
84
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;AA0B9C,4CAAgB;AAzBzB,kGAAsE;AACtE,6DAA8C;AAE9C,YAAY;AACZ,6BAAsC;AAA7B,2GAAA,OAAO,OAAO;AACvB,yCAAyD;AAAhD,oHAAA,yBAAyB,OAAA;AAClC,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB;AAChC,qCAIkB;AAHhB,mHAAA,OAAO,OAAW;AAIpB,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAE7B,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,OAAoB;AACpC,6DAAqE;AAA5D,gIAAA,OAAO,OAAiB;AACjC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,mEAA2E;AAAlE,sIAAA,OAAO,OAAoB;AACpC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,yEAAgF;AAAvE,2IAAA,OAAO,OAAsB;AAGtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,sCAAyB,CAAA;AAChC,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC3B,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,UAAU,GAAG,OA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AAO,OAAkB;AAClC,yEAAgF;AAAvE,2IAAA,OAAO,OAAsB;AAGtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,sCAAyB,CAAA;AAChC,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC3B,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAC7C,QAAA,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAA;AACnE,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AASL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\n\n// Top level\nexport { default as Cli } from './cli'\nexport { parseGherkinMessageStream } from './cli/helpers'\nexport { default as PickleFilter } from './pickle_filter'\nexport {\n default as Runtime,\n INewRuntimeOptions,\n IRuntimeOptions,\n} from './runtime'\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineParameterType = methods.defineParameterType\nexport const defineStep = methods.defineStep\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\n\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n\n// Time helpers\nexport { wrapPromiseWithTimeout } from './time'\n"]}
|
package/lib/models/data_table.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
7
3
|
class DataTable {
|
|
8
4
|
constructor(sourceTable) {
|
|
9
5
|
if (sourceTable instanceof Array) {
|
|
@@ -17,7 +13,11 @@ class DataTable {
|
|
|
17
13
|
const copy = this.raw();
|
|
18
14
|
const keys = copy[0];
|
|
19
15
|
const valuesArray = copy.slice(1);
|
|
20
|
-
return valuesArray.map((values) =>
|
|
16
|
+
return valuesArray.map((values) => {
|
|
17
|
+
const rowObject = {};
|
|
18
|
+
keys.forEach((key, index) => (rowObject[key] = values[index]));
|
|
19
|
+
return rowObject;
|
|
20
|
+
});
|
|
21
21
|
}
|
|
22
22
|
raw() {
|
|
23
23
|
return this.rawTable.slice(0);
|
|
@@ -29,11 +29,13 @@ class DataTable {
|
|
|
29
29
|
}
|
|
30
30
|
rowsHash() {
|
|
31
31
|
const rows = this.raw();
|
|
32
|
-
const everyRowHasTwoColumns =
|
|
32
|
+
const everyRowHasTwoColumns = rows.every((row) => row.length === 2);
|
|
33
33
|
if (!everyRowHasTwoColumns) {
|
|
34
34
|
throw new Error('rowsHash can only be called on a data table where all rows have exactly two columns');
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
const result = {};
|
|
37
|
+
rows.forEach((x) => (result[x[0]] = x[1]));
|
|
38
|
+
return result;
|
|
37
39
|
}
|
|
38
40
|
transpose() {
|
|
39
41
|
const transposed = this.rawTable[0].map((x, i) => this.rawTable.map((y) => y[i]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data_table.js","sourceRoot":"","sources":["../../src/models/data_table.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data_table.js","sourceRoot":"","sources":["../../src/models/data_table.ts"],"names":[],"mappings":";;AAEA,MAAqB,SAAS;IAG5B,YAAY,WAA8C;QACxD,IAAI,WAAW,YAAY,KAAK,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAA;SAC5B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,KAAK,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C,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1C,OAAO,MAAM,CAAA;IACf,CAAC;IAED,SAAS;QACP,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAA;QACD,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;CACF;AArDD,4BAqDC","sourcesContent":["import * as messages from '@cucumber/messages'\n\nexport default class DataTable {\n private readonly rawTable: string[][]\n\n constructor(sourceTable: messages.PickleTable | string[][]) {\n if (sourceTable instanceof Array) {\n this.rawTable = sourceTable\n } else {\n this.rawTable = sourceTable.rows.map((row) =>\n row.cells.map((cell) => cell.value)\n )\n }\n }\n\n hashes(): any[] {\n const copy = this.raw()\n const keys = copy[0]\n const valuesArray = copy.slice(1)\n return valuesArray.map((values) => {\n const rowObject: Record<string, string> = {}\n keys.forEach((key, index) => (rowObject[key] = values[index]))\n return rowObject\n })\n }\n\n raw(): string[][] {\n return this.rawTable.slice(0)\n }\n\n rows(): string[][] {\n const copy = this.raw()\n copy.shift()\n return copy\n }\n\n rowsHash(): Record<string, string> {\n const rows = this.raw()\n const everyRowHasTwoColumns = rows.every((row) => row.length === 2)\n if (!everyRowHasTwoColumns) {\n throw new Error(\n 'rowsHash can only be called on a data table where all rows have exactly two columns'\n )\n }\n const result: Record<string, string> = {}\n rows.forEach((x) => (result[x[0]] = x[1]))\n return result\n }\n\n transpose(): DataTable {\n const transposed = this.rawTable[0].map((x, i) =>\n this.rawTable.map((y) => y[i])\n )\n return new DataTable(transposed)\n }\n}\n"]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const data_table_1 = __importDefault(require("./data_table"));
|
|
7
7
|
const definition_1 = __importDefault(require("./definition"));
|
|
8
8
|
const step_arguments_1 = require("../step_arguments");
|
|
9
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
|
10
9
|
const value_checker_1 = require("../value_checker");
|
|
11
10
|
class StepDefinition extends definition_1.default {
|
|
12
11
|
constructor(data) {
|
|
@@ -15,7 +14,7 @@ class StepDefinition extends definition_1.default {
|
|
|
15
14
|
this.expression = data.expression;
|
|
16
15
|
}
|
|
17
16
|
async getInvocationParameters({ step, world, }) {
|
|
18
|
-
const parameters = await
|
|
17
|
+
const parameters = await Promise.all(this.expression.match(step.text).map((arg) => arg.getValue(world)));
|
|
19
18
|
if (value_checker_1.doesHaveValue(step.argument)) {
|
|
20
19
|
const argumentParamater = step_arguments_1.parseStepArgument(step.argument, {
|
|
21
20
|
dataTable: (arg) => new data_table_1.default(arg),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAoC;AACpC,8DAKqB;AACrB,sDAAqD;AAErD,
|
|
1
|
+
{"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAoC;AACpC,8DAKqB;AACrB,sDAAqD;AAErD,oDAAgD;AAEhD,MAAqB,cAAe,SAAQ,oBAAU;IAIpD,YAAY,IAA+B;QACzC,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,IAAI,EACJ,KAAK,GACqB;QAC1B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CACnE,CAAA;QACD,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,iBAAiB,GAAG,kCAAiB,CAAM,IAAI,CAAC,QAAQ,EAAE;gBAC9D,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,oBAAS,CAAC,GAAG,CAAC;gBACtC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO;aAChC,CAAC,CAAA;YACF,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;SACnC;QACD,OAAO;YACL,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,+BAA+B,CAAC,UAAU,CAAC;YAClD,UAAU;YACV,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;SAC7D,CAAA;IACH,CAAC;IAED,eAAe,CAAC,QAAgB;QAC9B,OAAO,6BAAa,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAnCD,iCAmCC","sourcesContent":["import DataTable from './data_table'\nimport Definition, {\n IDefinition,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IStepDefinitionParameters,\n} from './definition'\nimport { parseStepArgument } from '../step_arguments'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { doesHaveValue } from '../value_checker'\n\nexport default class StepDefinition extends Definition implements IDefinition {\n public readonly pattern: string | RegExp\n public readonly expression: Expression\n\n constructor(data: IStepDefinitionParameters) {\n super(data)\n this.pattern = data.pattern\n this.expression = data.expression\n }\n\n async getInvocationParameters({\n step,\n world,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n const parameters = await Promise.all(\n this.expression.match(step.text).map((arg) => arg.getValue(world))\n )\n if (doesHaveValue(step.argument)) {\n const argumentParamater = parseStepArgument<any>(step.argument, {\n dataTable: (arg) => new DataTable(arg),\n docString: (arg) => arg.content,\n })\n parameters.push(argumentParamater)\n }\n return {\n getInvalidCodeLengthMessage: () =>\n this.baseGetInvalidCodeLengthMessage(parameters),\n parameters,\n validCodeLengths: [parameters.length, parameters.length + 1],\n }\n }\n\n matchesStepName(stepName: string): boolean {\n return doesHaveValue(this.expression.match(stepName))\n }\n}\n"]}
|
package/lib/pickle_filter.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PickleTagFilter = exports.PickleNameFilter = exports.PickleLineFilter = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
9
8
|
const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
|
|
10
9
|
const gherkin_document_parser_1 = require("./formatter/helpers/gherkin_document_parser");
|
|
@@ -56,8 +55,9 @@ class PickleLineFilter {
|
|
|
56
55
|
const linesToMatch = this.featureUriToLinesMapping[uri];
|
|
57
56
|
if (value_checker_1.doesHaveValue(linesToMatch)) {
|
|
58
57
|
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
|
|
59
|
-
const pickleLines = pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line);
|
|
60
|
-
|
|
58
|
+
const pickleLines = new Set(pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line));
|
|
59
|
+
const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x));
|
|
60
|
+
return linesIntersection.length > 0;
|
|
61
61
|
}
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
@@ -71,7 +71,7 @@ class PickleNameFilter {
|
|
|
71
71
|
if (this.names.length === 0) {
|
|
72
72
|
return true;
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return this.names.some((name) => pickle.name.match(name));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
exports.PickleNameFilter = PickleNameFilter;
|
|
@@ -85,7 +85,7 @@ class PickleTagFilter {
|
|
|
85
85
|
if (value_checker_1.doesNotHaveValue(this.tagExpressionNode)) {
|
|
86
86
|
return true;
|
|
87
87
|
}
|
|
88
|
-
return this.tagExpressionNode.evaluate(
|
|
88
|
+
return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
exports.PickleTagFilter = PickleTagFilter;
|
package/lib/pickle_filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,gFAA6C;AAC7C,yFAA2F;AAC3F,mDAAiE;AAKjE,MAAM,sBAAsB,GAAG,uBAAuB,CAAA;AActD,MAAqB,YAAY;IAK/B,YAAY,EACV,GAAG,EACH,YAAY,EACZ,KAAK,EACL,aAAa,GACQ;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QACzD,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,CAAC,EACN,eAAe,EACf,MAAM,GAIP;QACC,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;YAC3D,IAA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AAgB,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACxE,CAAC;CACF;AAfD,0CAeC","sourcesContent":["import path from 'path'\nimport parse from '@cucumber/tag-expressions'\nimport { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser'\nimport { doesHaveValue, doesNotHaveValue } from './value_checker'\nimport * as messages from '@cucumber/messages'\nimport IGherkinDocument = messages.GherkinDocument\nimport IPickle = messages.Pickle\n\nconst FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\\d]+)+)?$/\n\nexport interface IPickleFilterOptions {\n cwd: string\n featurePaths?: string[]\n names?: string[]\n tagExpression?: string\n}\n\nexport interface IMatchesAnyLineRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport default class PickleFilter {\n private readonly lineFilter: PickleLineFilter\n private readonly nameFilter: PickleNameFilter\n private readonly tagFilter: PickleTagFilter\n\n constructor({\n cwd,\n featurePaths,\n names,\n tagExpression,\n }: IPickleFilterOptions) {\n this.lineFilter = new PickleLineFilter(cwd, featurePaths)\n this.nameFilter = new PickleNameFilter(names)\n this.tagFilter = new PickleTagFilter(tagExpression)\n }\n\n matches({\n gherkinDocument,\n pickle,\n }: {\n gherkinDocument: IGherkinDocument\n pickle: IPickle\n }): boolean {\n return (\n this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&\n this.nameFilter.matchesAnyName(pickle) &&\n this.tagFilter.matchesAllTagExpressions(pickle)\n )\n }\n}\n\nexport class PickleLineFilter {\n private readonly featureUriToLinesMapping: Record<string, number[]>\n\n constructor(cwd: string, featurePaths: string[] = []) {\n this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({\n featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n featurePaths,\n }: {\n featurePaths: string[]\n }): Record<string, number[]> {\n const mapping: Record<string, number[]> = {}\n featurePaths.forEach((featurePath) => {\n const match = FEATURE_LINENUM_REGEXP.exec(featurePath)\n if (doesHaveValue(match)) {\n const uri = path.normalize(match[1])\n const linesExpression = match[2]\n if (doesHaveValue(linesExpression)) {\n if (doesNotHaveValue(mapping[uri])) {\n mapping[uri] = []\n }\n linesExpression\n .slice(1)\n .split(':')\n .forEach((line) => {\n mapping[uri].push(parseInt(line))\n })\n }\n }\n })\n return mapping\n }\n\n matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean {\n const uri = path.normalize(pickle.uri)\n const linesToMatch = this.featureUriToLinesMapping[uri]\n if (doesHaveValue(linesToMatch)) {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleLines = new Set(\n pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n )\n const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x))\n return linesIntersection.length > 0\n }\n return true\n }\n}\n\nexport class PickleNameFilter {\n private readonly names: string[]\n\n constructor(names: string[] = []) {\n this.names = names\n }\n\n matchesAnyName(pickle: messages.Pickle): boolean {\n if (this.names.length === 0) {\n return true\n }\n return this.names.some((name) => pickle.name.match(name))\n }\n}\n\nexport class PickleTagFilter {\n private readonly tagExpressionNode: any // cucumber-tag-expressions does not export interface\n\n constructor(tagExpression: string) {\n if (doesHaveValue(tagExpression) && tagExpression !== '') {\n this.tagExpressionNode = parse(tagExpression)\n }\n }\n\n matchesAllTagExpressions(pickle: messages.Pickle): boolean {\n if (doesNotHaveValue(this.tagExpressionNode)) {\n return true\n }\n return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name))\n }\n}\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assembleTestCases = void 0;
|
|
4
4
|
const value_checker_1 = require("../value_checker");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
5
|
async function assembleTestCases({ eventBroadcaster, newId, pickles, supportCodeLibrary, }) {
|
|
7
6
|
const result = {};
|
|
8
7
|
for (const pickle of pickles) {
|
|
@@ -39,7 +38,8 @@ async function assembleTestCases({ eventBroadcaster, newId, pickles, supportCode
|
|
|
39
38
|
}
|
|
40
39
|
exports.assembleTestCases = assembleTestCases;
|
|
41
40
|
function makeAfterHookSteps({ supportCodeLibrary, pickle, newId, }) {
|
|
42
|
-
return
|
|
41
|
+
return supportCodeLibrary.afterTestCaseHookDefinitions
|
|
42
|
+
.slice(0)
|
|
43
43
|
.reverse()
|
|
44
44
|
.filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))
|
|
45
45
|
.map((hookDefinition) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/runtime/assemble_test_cases.ts"],"names":[],"mappings":";;;AAKA,oDAAgD;
|
|
1
|
+
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/runtime/assemble_test_cases.ts"],"names":[],"mappings":";;;AAKA,oDAAgD;AAWzC,KAAK,UAAU,iBAAiB,CAAC,EACtC,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,GACQ;IAC1B,MAAM,MAAM,GAAwB,EAAE,CAAA;IACtC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;QAC/B,MAAM,UAAU,GAAG,KAAK,EAAE,CAAA;QAC1B,MAAM,eAAe,GAAwB,mBAAmB,CAAC;YAC/D,kBAAkB;YAClB,MAAM;YACN,KAAK;SACN,CAAC,CAAA;QACF,MAAM,mBAAmB,GAAwB,SAAS,CAAC;YACzD,MAAM;YACN,kBAAkB;YAClB,KAAK;SACN,CAAC,CAAA;QAC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Emitter } from 'events'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { Group } from '@cucumber/cucumber-expressions'\nimport { doesHaveValue } from '../value_checker'\n\nexport declare type IAssembledTestCases = Record<string, messages.TestCase>\n\nexport interface IAssembleTestCasesOptions {\n eventBroadcaster: EventEmitter\n newId: IdGenerator.NewId\n pickles: messages.Pickle[]\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport async function assembleTestCases({\n eventBroadcaster,\n newId,\n pickles,\n supportCodeLibrary,\n}: IAssembleTestCasesOptions): Promise<IAssembledTestCases> {\n const result: IAssembledTestCases = {}\n for (const pickle of pickles) {\n const { id: pickleId } = pickle\n const testCaseId = newId()\n const fromBeforeHooks: messages.TestStep[] = makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const fromStepDefinitions: messages.TestStep[] = makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n })\n const fromAfterHooks: messages.TestStep[] = makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const testCase: messages.TestCase = {\n pickleId,\n id: testCaseId,\n testSteps: [\n ...fromBeforeHooks,\n ...fromStepDefinitions,\n ...fromAfterHooks,\n ],\n }\n eventBroadcaster.emit('envelope', { testCase })\n result[pickleId] = testCase\n }\n return result\n}\n\nfunction makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: ISupportCodeLibrary\n pickle: messages.Pickle\n newId: IdGenerator.NewId\n}): messages.TestStep[] {\n return supportCodeLibrary.afterTestCaseHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: ISupportCodeLibrary\n pickle: messages.Pickle\n newId: IdGenerator.NewId\n}): messages.TestStep[] {\n return supportCodeLibrary.beforeTestCaseHookDefinitions\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n}: {\n pickle: messages.Pickle\n supportCodeLibrary: ISupportCodeLibrary\n newId: () => string\n}): messages.TestStep[] {\n return pickle.steps.map((pickleStep) => {\n const stepDefinitions = supportCodeLibrary.stepDefinitions.filter(\n (stepDefinition) => stepDefinition.matchesStepName(pickleStep.text)\n )\n return {\n id: newId(),\n pickleStepId: pickleStep.id,\n stepDefinitionIds: stepDefinitions.map(\n (stepDefinition) => stepDefinition.id\n ),\n stepMatchArgumentsLists: stepDefinitions.map((stepDefinition) => {\n const result = stepDefinition.expression.match(pickleStep.text)\n return {\n stepMatchArguments: result.map((arg) => {\n return {\n group: mapArgumentGroup(arg.group),\n parameterTypeName: arg.parameterType.name,\n }\n }),\n }\n }),\n }\n })\n}\n\nfunction mapArgumentGroup(group: Group): messages.Group {\n return {\n start: group.start,\n value: group.value,\n children: doesHaveValue(group.children)\n ? group.children.map((child) => mapArgumentGroup(child))\n : undefined,\n }\n}\n"]}
|
package/lib/runtime/helpers.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ import * as messages from '@cucumber/messages';
|
|
|
3
3
|
import { IRuntimeOptions } from '.';
|
|
4
4
|
export declare function getAmbiguousStepException(stepDefinitions: StepDefinition[]): string;
|
|
5
5
|
export declare function retriesForPickle(pickle: messages.Pickle, options: IRuntimeOptions): number;
|
|
6
|
+
export declare function shouldCauseFailure(status: messages.TestStepResultStatus, options: IRuntimeOptions): boolean;
|
package/lib/runtime/helpers.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
5
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.retriesForPickle = exports.getAmbiguousStepException = void 0;
|
|
25
|
+
exports.shouldCauseFailure = exports.retriesForPickle = exports.getAmbiguousStepException = void 0;
|
|
7
26
|
const location_helpers_1 = require("../formatter/helpers/location_helpers");
|
|
8
27
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
9
28
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
10
29
|
const pickle_filter_1 = require("../pickle_filter");
|
|
30
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
11
31
|
function getAmbiguousStepException(stepDefinitions) {
|
|
12
32
|
const table = new cli_table3_1.default({
|
|
13
33
|
chars: {
|
|
@@ -56,4 +76,19 @@ function retriesForPickle(pickle, options) {
|
|
|
56
76
|
return 0;
|
|
57
77
|
}
|
|
58
78
|
exports.retriesForPickle = retriesForPickle;
|
|
79
|
+
function shouldCauseFailure(status, options) {
|
|
80
|
+
if (options.dryRun) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const failureStatuses = [
|
|
84
|
+
messages.TestStepResultStatus.AMBIGUOUS,
|
|
85
|
+
messages.TestStepResultStatus.FAILED,
|
|
86
|
+
messages.TestStepResultStatus.UNDEFINED,
|
|
87
|
+
];
|
|
88
|
+
if (options.strict) {
|
|
89
|
+
failureStatuses.push(messages.TestStepResultStatus.PENDING);
|
|
90
|
+
}
|
|
91
|
+
return failureStatuses.includes(status);
|
|
92
|
+
}
|
|
93
|
+
exports.shouldCauseFailure = shouldCauseFailure;
|
|
59
94
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAAsE;AACtE,4DAA8B;AAC9B,kEAAwC;AACxC,oDAAkD;AAElD,6DAA8C;AAG9C,SAAgB,yBAAyB,CACvC,eAAiC;IAEjC,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,c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AAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;KAC5D;IACD,OAAO,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC;AAhBD,gDAgBC","sourcesContent":["import { formatLocation } from '../formatter/helpers/location_helpers'\nimport Table from 'cli-table3'\nimport indentString from 'indent-string'\nimport { PickleTagFilter } from '../pickle_filter'\nimport StepDefinition from '../models/step_definition'\nimport * as messages from '@cucumber/messages'\nimport { IRuntimeOptions } from '.'\n\nexport function getAmbiguousStepException(\n stepDefinitions: StepDefinition[]\n): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' - ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(\n ...stepDefinitions.map((stepDefinition) => {\n const pattern = stepDefinition.pattern.toString()\n return [pattern, formatLocation(stepDefinition)]\n })\n )\n return `${'Multiple step definitions match:' + '\\n'}${indentString(\n table.toString(),\n 2\n )}`\n}\n\nexport function retriesForPickle(\n pickle: messages.Pickle,\n options: IRuntimeOptions\n): number {\n const retries = options.retry\n if (retries === 0) {\n return 0\n }\n const retryTagFilter = options.retryTagFilter\n if (retryTagFilter === '') {\n return retries\n }\n const pickleTagFilter = new PickleTagFilter(retryTagFilter)\n if (pickleTagFilter.matchesAllTagExpressions(pickle)) {\n return retries\n }\n return 0\n}\n\nexport function shouldCauseFailure(\n status: messages.TestStepResultStatus,\n options: IRuntimeOptions\n): boolean {\n if (options.dryRun) {\n return false\n }\n const failureStatuses: messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.UNDEFINED,\n ]\n if (options.strict) {\n failureStatuses.push(messages.TestStepResultStatus.PENDING)\n }\n return failureStatuses.includes(status)\n}\n"]}
|
package/lib/runtime/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export interface INewRuntimeOptions {
|
|
|
15
15
|
}
|
|
16
16
|
export interface IRuntimeOptions {
|
|
17
17
|
dryRun: boolean;
|
|
18
|
-
predictableIds: boolean;
|
|
19
18
|
failFast: boolean;
|
|
20
19
|
filterStacktraces: boolean;
|
|
21
20
|
retry: number;
|
|
@@ -37,5 +36,4 @@ export default class Runtime {
|
|
|
37
36
|
runTestRunHooks(definitions: TestRunHookDefinition[], name: string): Promise<void>;
|
|
38
37
|
runTestCase(pickleId: string, testCase: messages.TestCase): Promise<void>;
|
|
39
38
|
start(): Promise<boolean>;
|
|
40
|
-
shouldCauseFailure(status: messages.TestStepResultStatus): boolean;
|
|
41
39
|
}
|