@cucumber/cucumber 8.6.0 → 8.8.0

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.
Files changed (37) hide show
  1. package/lib/cli/helpers.d.ts +0 -2
  2. package/lib/cli/helpers.js +0 -2
  3. package/lib/cli/helpers.js.map +1 -1
  4. package/lib/filter_stack_trace.d.ts +3 -0
  5. package/lib/filter_stack_trace.js +38 -0
  6. package/lib/filter_stack_trace.js.map +1 -0
  7. package/lib/index.d.ts +25 -8
  8. package/lib/index.js +27 -13
  9. package/lib/index.js.map +1 -1
  10. package/lib/runtime/format_error.d.ts +1 -0
  11. package/lib/runtime/format_error.js +29 -0
  12. package/lib/runtime/format_error.js.map +1 -0
  13. package/lib/runtime/index.d.ts +0 -1
  14. package/lib/runtime/index.js +1 -8
  15. package/lib/runtime/index.js.map +1 -1
  16. package/lib/runtime/parallel/worker.d.ts +0 -1
  17. package/lib/runtime/parallel/worker.js +6 -11
  18. package/lib/runtime/parallel/worker.js.map +1 -1
  19. package/lib/runtime/step_runner.d.ts +2 -1
  20. package/lib/runtime/step_runner.js +3 -3
  21. package/lib/runtime/step_runner.js.map +1 -1
  22. package/lib/runtime/test_case_runner.d.ts +4 -1
  23. package/lib/runtime/test_case_runner.js +53 -47
  24. package/lib/runtime/test_case_runner.js.map +1 -1
  25. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +1 -1
  26. package/lib/support_code_library_builder/get_definition_line_and_uri.js +5 -6
  27. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
  28. package/lib/support_code_library_builder/index.js +1 -2
  29. package/lib/support_code_library_builder/index.js.map +1 -1
  30. package/lib/version.d.ts +1 -1
  31. package/lib/version.js +1 -1
  32. package/lib/version.js.map +1 -1
  33. package/lib/wrapper.mjs +6 -8
  34. package/package.json +25 -25
  35. package/lib/stack_trace_filter.d.ts +0 -11
  36. package/lib/stack_trace_filter.js +0 -46
  37. package/lib/stack_trace_filter.js.map +0 -1
@@ -20,8 +20,6 @@ interface IParseGherkinMessageStreamRequest {
20
20
  /**
21
21
  * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
22
22
  *
23
- * @deprecated use `loadSources` instead
24
- *
25
23
  * @param eventBroadcaster
26
24
  * @param eventDataCollector
27
25
  * @param gherkinMessageStream
@@ -38,8 +38,6 @@ const version_1 = require("../version");
38
38
  /**
39
39
  * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
40
40
  *
41
- * @deprecated use `loadSources` instead
42
- *
43
41
  * @param eventBroadcaster
44
42
  * @param eventDataCollector
45
43
  * @param gherkinMessageStream
@@ -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,kFAAuE;AACvE,wCAAoC;AAYpC;;;;;;;;;;GAUG;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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AG;oBAC/B,QAAQ,EAAE;wBACR,IAAI,EAAE,sBAAsB,CAAC,IAAI;qBAClC;iBACF;aACF;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;oBACf,GAAG,EAAE,qBAAqB,CAAC,GAAG;oBAC9B,QAAQ,EAAE;wBACR,IAAI,EAAE,qBAAqB,CAAC,IAAI;qBACjC;iBACF;aACF;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 { builtinParameterTypes } from '../support_code_library_builder'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\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 * @deprecated use `loadSources` instead\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\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 (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\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 },\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: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\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: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\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: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\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"]}
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,kFAAuE;AACvE,wCAAoC;AAYpC;;;;;;;;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,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,EAAE;oBACrD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;iBACtB;aACF;QACH,CAAC,CAAC,CAAA;QACF,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YAClC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;YACpC,OAAO,CAAC,MAAM,CAAC,C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AO,CAAC,CAAC,qBAA4C,EAAE,EAAE;QACxD,MAAM,QAAQ,GAAsB;YAClC,IAAI,EAAE;gBACJ,EAAE,EAAE,qBAAqB,CAAC,EAAE;gBAC5B,eAAe,EAAE;oBACf,GAAG,EAAE,qBAAqB,CAAC,GAAG;oBAC9B,QAAQ,EAAE;wBACR,IAAI,EAAE,qBAAqB,CAAC,IAAI;qBACjC;iBACF;aACF;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 { builtinParameterTypes } from '../support_code_library_builder'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\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\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 (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\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 },\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: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\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: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\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: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\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"]}
@@ -0,0 +1,3 @@
1
+ import { StackFrame } from 'error-stack-parser';
2
+ export declare function isFileNameInCucumber(fileName: string): boolean;
3
+ export declare function filterStackTrace(frames: StackFrame[]): StackFrame[];
@@ -0,0 +1,38 @@
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.filterStackTrace = exports.isFileNameInCucumber = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const value_checker_1 = require("./value_checker");
9
+ const projectRootPath = path_1.default.join(__dirname, '..');
10
+ const projectChildDirs = ['src', 'lib', 'node_modules'];
11
+ function isFileNameInCucumber(fileName) {
12
+ return projectChildDirs.some((dir) => fileName.startsWith(path_1.default.join(projectRootPath, dir)));
13
+ }
14
+ exports.isFileNameInCucumber = isFileNameInCucumber;
15
+ function filterStackTrace(frames) {
16
+ if (isErrorInCucumber(frames)) {
17
+ return frames;
18
+ }
19
+ const index = frames.findIndex((x) => isFrameInCucumber(x));
20
+ if (index === -1) {
21
+ return frames;
22
+ }
23
+ return frames.slice(0, index);
24
+ }
25
+ exports.filterStackTrace = filterStackTrace;
26
+ function isErrorInCucumber(frames) {
27
+ const filteredFrames = frames.filter((x) => !isFrameInNode(x));
28
+ return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0]);
29
+ }
30
+ function isFrameInCucumber(frame) {
31
+ const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
32
+ return isFileNameInCucumber(fileName);
33
+ }
34
+ function isFrameInNode(frame) {
35
+ const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
36
+ return !fileName.includes(path_1.default.sep);
37
+ }
38
+ //# sourceMappingURL=filter_stack_trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,mDAAgD;AAGhD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAClD,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;AAEvD,SAAgB,oBAAoB,CAAC,QAAgB;IACnD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,QAAQ,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CACrD,CAAA;AACH,CAAC;AAJD,oDAIC;AAED,SAAgB,gBAAgB,CAAC,MAAoB;IACnD,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC7B,OAAO,MAAM,CAAA;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,MAAM,CAAA;KACd;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC;AATD,4CASC;AAED,SAAS,iBAAiB,CAAC,MAAoB;IAC7C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9D,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAiB;IAC1C,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAI,CAAC,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import path from 'path'\nimport { valueOrDefault } from './value_checker'\nimport { StackFrame } from 'error-stack-parser'\n\nconst projectRootPath = path.join(__dirname, '..')\nconst projectChildDirs = ['src', 'lib', 'node_modules']\n\nexport function isFileNameInCucumber(fileName: string): boolean {\n return projectChildDirs.some((dir) =>\n fileName.startsWith(path.join(projectRootPath, dir))\n )\n}\n\nexport function filterStackTrace(frames: StackFrame[]): StackFrame[] {\n if (isErrorInCucumber(frames)) {\n return frames\n }\n const index = frames.findIndex((x) => isFrameInCucumber(x))\n if (index === -1) {\n return frames\n }\n return frames.slice(0, index)\n}\n\nfunction isErrorInCucumber(frames: StackFrame[]): boolean {\n const filteredFrames = frames.filter((x) => !isFrameInNode(x))\n return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0])\n}\n\nfunction isFrameInCucumber(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return isFileNameInCucumber(fileName)\n}\n\nfunction isFrameInNode(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return !fileName.includes(path.sep)\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
+ import { default as _Cli } from './cli';
2
+ import * as cliHelpers from './cli/helpers';
1
3
  import * as formatterHelpers from './formatter/helpers';
4
+ import { default as _PickleFilter } from './pickle_filter';
2
5
  import * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers';
6
+ import { default as _Runtime } from './runtime';
3
7
  import * as messages from '@cucumber/messages';
4
- export { default as Cli } from './cli';
5
- export { parseGherkinMessageStream } from './cli/helpers';
6
- export { default as PickleFilter } from './pickle_filter';
7
- export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
8
8
  export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
9
9
  export { default as DataTable } from './models/data_table';
10
10
  export { default as TestCaseHookDefinition } from './models/test_case_hook_definition';
@@ -26,10 +26,6 @@ export declare const Before: (<WorldType = import("./support_code_library_builde
26
26
  export declare const BeforeAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
27
27
  export declare const BeforeStep: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
28
28
  export declare const defineParameterType: (options: import("./support_code_library_builder/types").IParameterTypeDefinition<any>) => void;
29
- /**
30
- * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>
31
- */
32
- export declare const defineStep: import("./support_code_library_builder/types").IDefineStep;
33
29
  export declare const Given: import("./support_code_library_builder/types").IDefineStep;
34
30
  export declare const setDefaultTimeout: (milliseconds: number) => void;
35
31
  export declare const setDefinitionFunctionWrapper: (fn: Function) => void;
@@ -42,3 +38,24 @@ export { parallelCanAssignHelpers };
42
38
  export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
43
39
  export declare const Status: typeof messages.TestStepResultStatus;
44
40
  export { wrapPromiseWithTimeout } from './time';
41
+ /**
42
+ * @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
43
+ */
44
+ export declare const Cli: typeof _Cli;
45
+ /**
46
+ * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
47
+ */
48
+ export declare const defineStep: import("./support_code_library_builder/types").IDefineStep;
49
+ /**
50
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
51
+ */
52
+ export declare const parseGherkinMessageStream: typeof cliHelpers.parseGherkinMessageStream;
53
+ /**
54
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
55
+ */
56
+ export declare const PickleFilter: typeof _PickleFilter;
57
+ /**
58
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
59
+ */
60
+ export declare const Runtime: typeof _Runtime;
61
+ export { INewRuntimeOptions, IRuntimeOptions } from './runtime';
package/lib/index.js CHANGED
@@ -26,22 +26,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = 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.version = exports.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
29
+ exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.defineStep = exports.Cli = exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = 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.version = exports.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = void 0;
30
+ const cli_1 = __importDefault(require("./cli"));
31
+ const cliHelpers = __importStar(require("./cli/helpers"));
30
32
  const formatterHelpers = __importStar(require("./formatter/helpers"));
31
33
  exports.formatterHelpers = formatterHelpers;
34
+ const pickle_filter_1 = __importDefault(require("./pickle_filter"));
32
35
  const parallelCanAssignHelpers = __importStar(require("./support_code_library_builder/parallel_can_assign_helpers"));
33
36
  exports.parallelCanAssignHelpers = parallelCanAssignHelpers;
37
+ const runtime_1 = __importDefault(require("./runtime"));
34
38
  const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
35
39
  const messages = __importStar(require("@cucumber/messages"));
40
+ const util_1 = require("util");
36
41
  // Top level
37
- var cli_1 = require("./cli");
38
- Object.defineProperty(exports, "Cli", { enumerable: true, get: function () { return __importDefault(cli_1).default; } });
39
- var helpers_1 = require("./cli/helpers");
40
- Object.defineProperty(exports, "parseGherkinMessageStream", { enumerable: true, get: function () { return helpers_1.parseGherkinMessageStream; } });
41
- var pickle_filter_1 = require("./pickle_filter");
42
- Object.defineProperty(exports, "PickleFilter", { enumerable: true, get: function () { return __importDefault(pickle_filter_1).default; } });
43
- var runtime_1 = require("./runtime");
44
- Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return __importDefault(runtime_1).default; } });
45
42
  var support_code_library_builder_2 = require("./support_code_library_builder");
46
43
  Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
47
44
  var data_table_1 = require("./models/data_table");
@@ -78,10 +75,6 @@ exports.Before = methods.Before;
78
75
  exports.BeforeAll = methods.BeforeAll;
79
76
  exports.BeforeStep = methods.BeforeStep;
80
77
  exports.defineParameterType = methods.defineParameterType;
81
- /**
82
- * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>
83
- */
84
- exports.defineStep = methods.defineStep;
85
78
  exports.Given = methods.Given;
86
79
  exports.setDefaultTimeout = methods.setDefaultTimeout;
87
80
  exports.setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;
@@ -95,4 +88,25 @@ exports.Status = messages.TestStepResultStatus;
95
88
  // Time helpers
96
89
  var time_1 = require("./time");
97
90
  Object.defineProperty(exports, "wrapPromiseWithTimeout", { enumerable: true, get: function () { return time_1.wrapPromiseWithTimeout; } });
91
+ // Deprecated
92
+ /**
93
+ * @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
94
+ */
95
+ exports.Cli = (0, util_1.deprecate)(cli_1.default, '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
96
+ /**
97
+ * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
98
+ */
99
+ exports.defineStep = (0, util_1.deprecate)(methods.defineStep, '`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
100
+ /**
101
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
102
+ */
103
+ exports.parseGherkinMessageStream = (0, util_1.deprecate)(cliHelpers.parseGherkinMessageStream, '`parseGherkinMessageStream` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
104
+ /**
105
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
106
+ */
107
+ exports.PickleFilter = (0, util_1.deprecate)(pickle_filter_1.default, '`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
108
+ /**
109
+ * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
110
+ */
111
+ exports.Runtime = (0, util_1.deprecate)(runtime_1.default, '`Runtime` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
98
112
  //# 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;AA6B9C,4CAAgB;AA5BzB,qHAAsG;AAuD7F,4DAAwB;AAtDjC,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;AAC7B,gFAAsF;AAA7E,oJAAA,OAAO,OAA0B;AAC1C,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,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,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AAC9D;;GAEG;AACU,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,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAA;AACnD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AAUL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_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'\nexport { default as TestCaseHookDefinition } from './models/test_case_hook_definition'\nexport { version } from './version'\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\n/**\n * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>\n */\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 setParallelCanAssign = methods.setParallelCanAssign\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'\nexport { parallelCanAssignHelpers }\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuC;AACvC,0DAA2C;AAC3C,sEAAuD;AAwB9C,4CAAgB;AAvBzB,oEAA0D;AAC1D,qHAAsG;AA6C7F,4DAAwB;AA5CjC,wDAA+C;AAC/C,kGAAsE;AACtE,6DAA8C;AAC9C,+BAAgC;AAEhC,YAA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AAA;AACnD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AAUL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA;AAE/B,aAAa;AACb;;GAEG;AACU,QAAA,GAAG,GAAG,IAAA,gBAAS,EAC1B,aAAI,EACJ,4HAA4H,CAC7H,CAAA;AACD;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,gBAAS,EACjC,OAAO,CAAC,UAAU,EAClB,+IAA+I,CAChJ,CAAA;AACD;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,gBAAS,EAChD,UAAU,CAAC,yBAAyB,EACpC,kJAAkJ,CACnJ,CAAA;AACD;;GAEG;AACU,QAAA,YAAY,GAAG,IAAA,gBAAS,EACnC,uBAAa,EACb,qIAAqI,CACtI,CAAA;AACD;;GAEG;AACU,QAAA,OAAO,GAAG,IAAA,gBAAS,EAC9B,iBAAQ,EACR,gIAAgI,CACjI,CAAA","sourcesContent":["import { default as _Cli } from './cli'\nimport * as cliHelpers from './cli/helpers'\nimport * as formatterHelpers from './formatter/helpers'\nimport { default as _PickleFilter } from './pickle_filter'\nimport * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers'\nimport { default as _Runtime } from './runtime'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\nimport { deprecate } from 'util'\n\n// Top level\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\nexport { default as TestCaseHookDefinition } from './models/test_case_hook_definition'\nexport { version } from './version'\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 Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const setParallelCanAssign = methods.setParallelCanAssign\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'\nexport { parallelCanAssignHelpers }\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\n// Deprecated\n/**\n * @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const Cli = deprecate(\n _Cli,\n '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const defineStep = deprecate(\n methods.defineStep,\n '`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const parseGherkinMessageStream = deprecate(\n cliHelpers.parseGherkinMessageStream,\n '`parseGherkinMessageStream` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const PickleFilter = deprecate(\n _PickleFilter,\n '`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const Runtime = deprecate(\n _Runtime,\n '`Runtime` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\nexport { INewRuntimeOptions, IRuntimeOptions } from './runtime'\n"]}
@@ -0,0 +1 @@
1
+ export declare function formatError(error: Error, filterStackTraces: boolean): string;
@@ -0,0 +1,29 @@
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.formatError = void 0;
7
+ const assertion_error_formatter_1 = require("assertion-error-formatter");
8
+ const error_stack_parser_1 = __importDefault(require("error-stack-parser"));
9
+ const filter_stack_trace_1 = require("../filter_stack_trace");
10
+ function formatError(error, filterStackTraces) {
11
+ let filteredStack;
12
+ if (filterStackTraces) {
13
+ try {
14
+ filteredStack = (0, filter_stack_trace_1.filterStackTrace)(error_stack_parser_1.default.parse(error))
15
+ .map((f) => f.source)
16
+ .join('\n');
17
+ }
18
+ catch (_a) {
19
+ // if we weren't able to parse and filter, we'll settle for the original
20
+ }
21
+ }
22
+ return (0, assertion_error_formatter_1.format)(error, {
23
+ colorFns: {
24
+ errorStack: (stack) => filteredStack ? `\n${filteredStack}` : stack,
25
+ },
26
+ });
27
+ }
28
+ exports.formatError = formatError;
29
+ //# sourceMappingURL=format_error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;;AAAA,yEAAkD;AAClD,4EAAiD;AACjD,8DAAwD;AAExD,SAAgB,WAAW,CAAC,KAAY,EAAE,iBAA0B;IAClE,IAAI,aAAqB,CAAA;IACzB,IAAI,iBAAiB,EAAE;QACrB,IAAI;YACF,aAAa,GAAG,IAAA,qCAAgB,EAAC,4BAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBAC5D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACpB,IAAI,CAAC,IAAI,CAAC,CAAA;SACd;QAAC,WAAM;YACN,wEAAwE;SACzE;KACF;IACD,OAAO,IAAA,kCAAM,EAAC,KAAK,EAAE;QACnB,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAC5B,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC,CAAC,CAAC,KAAK;SAC/C;KACF,CAAC,CAAA;AACJ,CAAC;AAjBD,kCAiBC","sourcesContent":["import { format } from 'assertion-error-formatter'\nimport errorStackParser from 'error-stack-parser'\nimport { filterStackTrace } from '../filter_stack_trace'\n\nexport function formatError(error: Error, filterStackTraces: boolean): string {\n let filteredStack: string\n if (filterStackTraces) {\n try {\n filteredStack = filterStackTrace(errorStackParser.parse(error))\n .map((f) => f.source)\n .join('\\n')\n } catch {\n // if we weren't able to parse and filter, we'll settle for the original\n }\n }\n return format(error, {\n colorFns: {\n errorStack: (stack: string) =>\n filteredStack ? `\\n${filteredStack}` : stack,\n },\n })\n}\n"]}
@@ -31,7 +31,6 @@ export default class Runtime implements IRuntime {
31
31
  private readonly newId;
32
32
  private readonly options;
33
33
  private readonly pickleIds;
34
- private readonly stackTraceFilter;
35
34
  private readonly supportCodeLibrary;
36
35
  private success;
37
36
  private runTestRunHooks;
@@ -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 stack_trace_filter_1 = __importDefault(require("../stack_trace_filter"));
7
6
  const assemble_test_cases_1 = require("./assemble_test_cases");
8
7
  const helpers_1 = require("./helpers");
9
8
  const run_test_run_hooks_1 = require("./run_test_run_hooks");
@@ -17,7 +16,6 @@ class Runtime {
17
16
  this.newId = newId;
18
17
  this.options = options;
19
18
  this.pickleIds = pickleIds;
20
- this.stackTraceFilter = new stack_trace_filter_1.default();
21
19
  this.supportCodeLibrary = supportCodeLibrary;
22
20
  this.success = true;
23
21
  this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(this.options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored, process exiting: ${location}`);
@@ -35,6 +33,7 @@ class Runtime {
35
33
  testCase,
36
34
  retries,
37
35
  skip,
36
+ filterStackTraces: this.options.filterStacktraces,
38
37
  supportCodeLibrary: this.supportCodeLibrary,
39
38
  worldParameters: this.options.worldParameters,
40
39
  });
@@ -44,9 +43,6 @@ class Runtime {
44
43
  }
45
44
  }
46
45
  async start() {
47
- if (this.options.filterStacktraces) {
48
- this.stackTraceFilter.filter();
49
- }
50
46
  const testRunStarted = {
51
47
  testRunStarted: {
52
48
  timestamp: this.stopwatch.timestamp(),
@@ -73,9 +69,6 @@ class Runtime {
73
69
  },
74
70
  };
75
71
  this.eventBroadcaster.emit('envelope', testRunFinished);
76
- if (this.options.filterStacktraces) {
77
- this.stackTraceFilter.unfilter();
78
- }
79
72
  return this.success;
80
73
  }
81
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;;AAIA,+EAAoD;AAEpD,+DAAyD;AACzD,uCAAgE;AAChE,6DAA4E;AAC5E,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,CAC5C;YACD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;YACrC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAA;SAC/D;QACD,MAAM,IAAI,CAAC,eAAe,CACxB,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EACtE,aAAa,CACd,CAAA;QACD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;QACrB,MAAM,eAAe,GAAsB;YACzC,eAAe,EAAE;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;gBACrC,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;QACvD,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;YAClC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAA;SACjC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAxGD,0BAwGC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport StackTraceFilter from '../stack_trace_filter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { assembleTestCases } from './assemble_test_cases'\nimport { retriesForPickle, shouldCauseFailure } from './helpers'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from './run_test_run_hooks'\nimport { ITestRunStopwatch, RealTestRunStopwatch } from './stopwatch'\nimport TestCaseRunner from './test_case_runner'\n\nexport interface IRuntime {\n start: () => Promise<boolean>\n}\n\nexport interface INewRuntimeOptions {\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n options: IRuntimeOptions\n pickleIds: string[]\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IRuntimeOptions {\n dryRun: boolean\n failFast: boolean\n filterStacktraces: boolean\n retry: number\n retryTagFilter: string\n strict: boolean\n worldParameters: any\n}\n\nexport default class Runtime implements IRuntime {\n private readonly eventBroadcaster: EventEmitter\n private readonly eventDataCollector: EventDataCollector\n private readonly stopwatch: ITestRunStopwatch\n private readonly newId: IdGenerator.NewId\n private readonly options: IRuntimeOptions\n private readonly pickleIds: string[]\n private readonly stackTraceFilter: StackTraceFilter\n private readonly supportCodeLibrary: ISupportCodeLibrary\n private success: boolean\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n eventBroadcaster,\n eventDataCollector,\n newId,\n options,\n pickleIds,\n supportCodeLibrary,\n }: INewRuntimeOptions) {\n this.eventBroadcaster = eventBroadcaster\n this.eventDataCollector = eventDataCollector\n this.stopwatch = new RealTestRunStopwatch()\n this.newId = newId\n this.options = options\n this.pickleIds = pickleIds\n this.stackTraceFilter = new StackTraceFilter()\n this.supportCodeLibrary = supportCodeLibrary\n this.success = true\n this.runTestRunHooks = makeRunTestRunHooks(\n this.options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) => `${name} hook errored, process exiting: ${location}`\n )\n }\n\n async runTestCase(\n pickleId: string,\n testCase: messages.TestCase\n ): Promise<void> {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n const retries = retriesForPickle(pickle, this.options)\n const skip = this.options.dryRun || (this.options.failFast && !this.success)\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch: this.stopwatch,\n gherkinDocument: this.eventDataCollector.getGherkinDocument(pickle.uri),\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.options.worldParameters,\n })\n const status = await testCaseRunner.run()\n if (shouldCauseFailure(status, this.options)) {\n this.success = false\n }\n }\n\n async start(): Promise<boolean> {\n if (this.options.filterStacktraces) {\n this.stackTraceFilter.filter()\n }\n const testRunStarted: messages.Envelope = {\n testRunStarted: {\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testRunStarted)\n this.stopwatch.start()\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n const assembledTestCases = await assembleTestCases({\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n pickles: this.pickleIds.map((pickleId) =>\n this.eventDataCollector.getPickle(pickleId)\n ),\n supportCodeLibrary: this.supportCodeLibrary,\n })\n for (const pickleId of this.pickleIds) {\n await this.runTestCase(pickleId, assembledTestCases[pickleId])\n }\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse(),\n 'an AfterAll'\n )\n this.stopwatch.stop()\n const testRunFinished: messages.Envelope = {\n testRunFinished: {\n timestamp: this.stopwatch.timestamp(),\n success: this.success,\n },\n }\n this.eventBroadcaster.emit('envelope', testRunFinished)\n if (this.options.filterStacktraces) {\n this.stackTraceFilter.unfilter()\n }\n return this.success\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;;AAKA,+DAAyD;AACzD,uCAAgE;AAChE,6DAA4E;AAC5E,2CAAqE;AACrE,0EAA+C;AAyB/C,MAAqB,OAAO;IAW1B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,OAAO,EACP,SAAS,EACT,kBAAkB,GACC;QACnB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;QAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,gCAAoB,EAAE,CAAA;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CA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EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;gBACrC,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAA;QACvD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAjGD,0BAiGC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { assembleTestCases } from './assemble_test_cases'\nimport { retriesForPickle, shouldCauseFailure } from './helpers'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from './run_test_run_hooks'\nimport { ITestRunStopwatch, RealTestRunStopwatch } from './stopwatch'\nimport TestCaseRunner from './test_case_runner'\n\nexport interface IRuntime {\n start: () => Promise<boolean>\n}\n\nexport interface INewRuntimeOptions {\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n options: IRuntimeOptions\n pickleIds: string[]\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IRuntimeOptions {\n dryRun: boolean\n failFast: boolean\n filterStacktraces: boolean\n retry: number\n retryTagFilter: string\n strict: boolean\n worldParameters: any\n}\n\nexport default class Runtime implements IRuntime {\n private readonly eventBroadcaster: EventEmitter\n private readonly eventDataCollector: EventDataCollector\n private readonly stopwatch: ITestRunStopwatch\n private readonly newId: IdGenerator.NewId\n private readonly options: IRuntimeOptions\n private readonly pickleIds: string[]\n private readonly supportCodeLibrary: ISupportCodeLibrary\n private success: boolean\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n eventBroadcaster,\n eventDataCollector,\n newId,\n options,\n pickleIds,\n supportCodeLibrary,\n }: INewRuntimeOptions) {\n this.eventBroadcaster = eventBroadcaster\n this.eventDataCollector = eventDataCollector\n this.stopwatch = new RealTestRunStopwatch()\n this.newId = newId\n this.options = options\n this.pickleIds = pickleIds\n this.supportCodeLibrary = supportCodeLibrary\n this.success = true\n this.runTestRunHooks = makeRunTestRunHooks(\n this.options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) => `${name} hook errored, process exiting: ${location}`\n )\n }\n\n async runTestCase(\n pickleId: string,\n testCase: messages.TestCase\n ): Promise<void> {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n const retries = retriesForPickle(pickle, this.options)\n const skip = this.options.dryRun || (this.options.failFast && !this.success)\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch: this.stopwatch,\n gherkinDocument: this.eventDataCollector.getGherkinDocument(pickle.uri),\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n filterStackTraces: this.options.filterStacktraces,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.options.worldParameters,\n })\n const status = await testCaseRunner.run()\n if (shouldCauseFailure(status, this.options)) {\n this.success = false\n }\n }\n\n async start(): Promise<boolean> {\n const testRunStarted: messages.Envelope = {\n testRunStarted: {\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testRunStarted)\n this.stopwatch.start()\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n const assembledTestCases = await assembleTestCases({\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n pickles: this.pickleIds.map((pickleId) =>\n this.eventDataCollector.getPickle(pickleId)\n ),\n supportCodeLibrary: this.supportCodeLibrary,\n })\n for (const pickleId of this.pickleIds) {\n await this.runTestCase(pickleId, assembledTestCases[pickleId])\n }\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse(),\n 'an AfterAll'\n )\n this.stopwatch.stop()\n const testRunFinished: messages.Envelope = {\n testRunFinished: {\n timestamp: this.stopwatch.timestamp(),\n success: this.success,\n },\n }\n this.eventBroadcaster.emit('envelope', testRunFinished)\n return this.success\n }\n}\n"]}
@@ -9,7 +9,6 @@ export default class Worker {
9
9
  private filterStacktraces;
10
10
  private readonly newId;
11
11
  private readonly sendMessage;
12
- private readonly stackTraceFilter;
13
12
  private supportCodeLibrary;
14
13
  private worldParameters;
15
14
  private runTestRunHooks;
@@ -7,7 +7,6 @@ const messages_1 = require("@cucumber/messages");
7
7
  const durations_1 = require("durations");
8
8
  const events_1 = require("events");
9
9
  const url_1 = require("url");
10
- const stack_trace_filter_1 = __importDefault(require("../../stack_trace_filter"));
11
10
  const support_code_library_builder_1 = __importDefault(require("../../support_code_library_builder"));
12
11
  const value_checker_1 = require("../../value_checker");
13
12
  const run_test_run_hooks_1 = require("../run_test_run_hooks");
@@ -24,11 +23,12 @@ class Worker {
24
23
  this.exit = exit;
25
24
  this.sendMessage = sendMessage;
26
25
  this.eventBroadcaster = new events_1.EventEmitter();
27
- this.stackTraceFilter = new stack_trace_filter_1.default();
28
26
  this.eventBroadcaster.on('envelope', (envelope) => {
29
- this.sendMessage({
30
- jsonEnvelope: JSON.stringify(envelope),
31
- });
27
+ // assign `workerId` property only for the `testCaseStarted` message
28
+ if (envelope.testCaseStarted) {
29
+ envelope.testCaseStarted.workerId = this.id;
30
+ }
31
+ this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) });
32
32
  });
33
33
  }
34
34
  async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }) {
@@ -41,18 +41,12 @@ class Worker {
41
41
  this.supportCodeLibrary = support_code_library_builder_1.default.finalize(supportCodeIds);
42
42
  this.worldParameters = options.worldParameters;
43
43
  this.filterStacktraces = filterStacktraces;
44
- if (this.filterStacktraces) {
45
- this.stackTraceFilter.filter();
46
- }
47
44
  this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored on worker ${this.id}, process exiting: ${location}`);
48
45
  await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
49
46
  this.sendMessage({ ready: true });
50
47
  }
51
48
  async finalize() {
52
49
  await this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions, 'an AfterAll');
53
- if (this.filterStacktraces) {
54
- this.stackTraceFilter.unfilter();
55
- }
56
50
  this.exit(0);
57
51
  }
58
52
  async receiveMessage(message) {
@@ -78,6 +72,7 @@ class Worker {
78
72
  testCase,
79
73
  retries,
80
74
  skip,
75
+ filterStackTraces: this.filterStacktraces,
81
76
  supportCodeLibrary: this.supportCodeLibrary,
82
77
  worldParameters: this.worldParameters,
83
78
  });
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;AACA,iDAAgD;AAChD,yCAAoC;AACpC,mCAAqC;AACrC,6BAAmC;AACnC,kFAAuD;AACvD,sGAA0E;AAE1E,uDAAmD;AACnD,8DAA6E;AAC7E,4CAAmD;AACnD,2EAAgD;AAQhD,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAA;AAK5B,MAAqB,MAAM;IAczB,YAAY,EACV,GAAG,EACH,IAAI,EACJ,EAAE,EACF,WAAW,GAMZ;QACC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,CAAA;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAY,EAAE,CAAA;QAC1C,IAAI,CAAC,gBAAgB,GAAG,IAAI,4BAAgB,EAAE,CAAA;QAC9C,IAAI,CAAC,gBAAgB,C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,IAAI;YACJ,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC,CAAA;QACF,MAAM,cAAc,CAAC,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC;CACF;AAvHD,yBAuHC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { duration } from 'durations'\nimport { EventEmitter } from 'events'\nimport { pathToFileURL } from 'url'\nimport StackTraceFilter from '../../stack_trace_filter'\nimport supportCodeLibraryBuilder from '../../support_code_library_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { doesHaveValue } from '../../value_checker'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from '../run_test_run_hooks'\nimport { RealTestRunStopwatch } from '../stopwatch'\nimport TestCaseRunner from '../test_case_runner'\nimport {\n ICoordinatorReport,\n IWorkerCommand,\n IWorkerCommandInitialize,\n IWorkerCommandRun,\n} from './command_types'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../../importer')\nconst { uuid } = IdGenerator\n\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void\ntype IMessageSender = (command: ICoordinatorReport) => void\n\nexport default class Worker {\n private readonly cwd: string\n private readonly exit: IExitFunction\n\n private readonly id: string\n private readonly eventBroadcaster: EventEmitter\n private filterStacktraces: boolean\n private readonly newId: IdGenerator.NewId\n private readonly sendMessage: IMessageSender\n private readonly stackTraceFilter: StackTraceFilter\n private supportCodeLibrary: ISupportCodeLibrary\n private worldParameters: any\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n cwd,\n exit,\n id,\n sendMessage,\n }: {\n cwd: string\n exit: IExitFunction\n id: string\n sendMessage: IMessageSender\n }) {\n this.id = id\n this.newId = uuid()\n this.cwd = cwd\n this.exit = exit\n this.sendMessage = sendMessage\n this.eventBroadcaster = new EventEmitter()\n this.stackTraceFilter = new StackTraceFilter()\n this.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n this.sendMessage({\n jsonEnvelope: JSON.stringify(envelope),\n })\n })\n }\n\n async initialize({\n filterStacktraces,\n requireModules,\n requirePaths,\n importPaths,\n supportCodeIds,\n options,\n }: IWorkerCommandInitialize): Promise<void> {\n supportCodeLibraryBuilder.reset(this.cwd, this.newId)\n requireModules.map((module) => require(module))\n requirePaths.map((module) => require(module))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n this.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds)\n\n this.worldParameters = options.worldParameters\n this.filterStacktraces = filterStacktraces\n if (this.filterStacktraces) {\n this.stackTraceFilter.filter()\n }\n this.runTestRunHooks = makeRunTestRunHooks(\n options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) =>\n `${name} hook errored on worker ${this.id}, process exiting: ${location}`\n )\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n this.sendMessage({ ready: true })\n }\n\n async finalize(): Promise<void> {\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions,\n 'an AfterAll'\n )\n if (this.filterStacktraces) {\n this.stackTraceFilter.unfilter()\n }\n this.exit(0)\n }\n\n async receiveMessage(message: IWorkerCommand): Promise<void> {\n if (doesHaveValue(message.initialize)) {\n await this.initialize(message.initialize)\n } else if (message.finalize) {\n await this.finalize()\n } else if (doesHaveValue(message.run)) {\n await this.runTestCase(message.run)\n }\n }\n\n async runTestCase({\n gherkinDocument,\n pickle,\n testCase,\n elapsed,\n retries,\n skip,\n }: IWorkerCommandRun): Promise<void> {\n const stopwatch = new RealTestRunStopwatch()\n stopwatch.from(duration(elapsed))\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch,\n gherkinDocument,\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.worldParameters,\n })\n await testCaseRunner.run()\n this.sendMessage({ ready: true })\n }\n}\n"]}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;AACA,iDAAgD;AAChD,yCAAoC;AACpC,mCAAqC;AACrC,6BAAmC;AACnC,sGAA0E;AAE1E,uDAAmD;AACnD,8DAA6E;AAC7E,4CAAmD;AACnD,2EAAgD;AAQhD,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAA;AAK5B,MAAqB,MAAM;IAazB,YAAY,EACV,GAAG,EACH,IAAI,EACJ,EAAE,EACF,WAAW,GAMZ;QACC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,CAAA;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAY,EAAE,CAAA;QAC1C,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACnE,oEAAoE;YACpE,IAAI,QAAQ,CAAC,eAAe,EAAE;gBAC5B,QAAQ,CAAC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAA;aAC5C;YACD,IAAI,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EACf,iBAAiB,EACjB,cAAc,EACd,YAAY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AAuB;QAC1C,IAAI,IAAA,6BAAa,EAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YACrC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;SAC1C;aAAM,IAAI,OAAO,CAAC,QAAQ,EAAE;YAC3B,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAA;SACtB;aAAM,IAAI,IAAA,6BAAa,EAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;SACpC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAChB,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,IAAI,GACc;QAClB,MAAM,SAAS,GAAG,IAAI,gCAAoB,EAAE,CAAA;QAC5C,SAAS,CAAC,IAAI,CAAC,IAAA,oBAAQ,EAAC,OAAO,CAAC,CAAC,CAAA;QACjC,MAAM,cAAc,GAAG,IAAI,0BAAc,CAAC;YACxC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,SAAS;YACT,eAAe;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM;YACN,QAAQ;YACR,OAAO;YACP,IAAI;YACJ,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC,CAAA;QACF,MAAM,cAAc,CAAC,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC;CACF;AAlHD,yBAkHC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { duration } from 'durations'\nimport { EventEmitter } from 'events'\nimport { pathToFileURL } from 'url'\nimport supportCodeLibraryBuilder from '../../support_code_library_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { doesHaveValue } from '../../value_checker'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from '../run_test_run_hooks'\nimport { RealTestRunStopwatch } from '../stopwatch'\nimport TestCaseRunner from '../test_case_runner'\nimport {\n ICoordinatorReport,\n IWorkerCommand,\n IWorkerCommandInitialize,\n IWorkerCommandRun,\n} from './command_types'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../../importer')\nconst { uuid } = IdGenerator\n\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void\ntype IMessageSender = (command: ICoordinatorReport) => void\n\nexport default class Worker {\n private readonly cwd: string\n private readonly exit: IExitFunction\n\n private readonly id: string\n private readonly eventBroadcaster: EventEmitter\n private filterStacktraces: boolean\n private readonly newId: IdGenerator.NewId\n private readonly sendMessage: IMessageSender\n private supportCodeLibrary: ISupportCodeLibrary\n private worldParameters: any\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n cwd,\n exit,\n id,\n sendMessage,\n }: {\n cwd: string\n exit: IExitFunction\n id: string\n sendMessage: IMessageSender\n }) {\n this.id = id\n this.newId = uuid()\n this.cwd = cwd\n this.exit = exit\n this.sendMessage = sendMessage\n this.eventBroadcaster = new EventEmitter()\n this.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n // assign `workerId` property only for the `testCaseStarted` message\n if (envelope.testCaseStarted) {\n envelope.testCaseStarted.workerId = this.id\n }\n this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) })\n })\n }\n\n async initialize({\n filterStacktraces,\n requireModules,\n requirePaths,\n importPaths,\n supportCodeIds,\n options,\n }: IWorkerCommandInitialize): Promise<void> {\n supportCodeLibraryBuilder.reset(this.cwd, this.newId)\n requireModules.map((module) => require(module))\n requirePaths.map((module) => require(module))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n this.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds)\n\n this.worldParameters = options.worldParameters\n this.filterStacktraces = filterStacktraces\n this.runTestRunHooks = makeRunTestRunHooks(\n options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) =>\n `${name} hook errored on worker ${this.id}, process exiting: ${location}`\n )\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n this.sendMessage({ ready: true })\n }\n\n async finalize(): Promise<void> {\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions,\n 'an AfterAll'\n )\n this.exit(0)\n }\n\n async receiveMessage(message: IWorkerCommand): Promise<void> {\n if (doesHaveValue(message.initialize)) {\n await this.initialize(message.initialize)\n } else if (message.finalize) {\n await this.finalize()\n } else if (doesHaveValue(message.run)) {\n await this.runTestCase(message.run)\n }\n }\n\n async runTestCase({\n gherkinDocument,\n pickle,\n testCase,\n elapsed,\n retries,\n skip,\n }: IWorkerCommandRun): Promise<void> {\n const stopwatch = new RealTestRunStopwatch()\n stopwatch.from(duration(elapsed))\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch,\n gherkinDocument,\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n filterStackTraces: this.filterStacktraces,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.worldParameters,\n })\n await testCaseRunner.run()\n this.sendMessage({ ready: true })\n }\n}\n"]}
@@ -3,12 +3,13 @@ import { ITestCaseHookParameter } from '../support_code_library_builder/types';
3
3
  import { IDefinition } from '../models/definition';
4
4
  export interface IRunOptions {
5
5
  defaultTimeout: number;
6
+ filterStackTraces: boolean;
6
7
  hookParameter: ITestCaseHookParameter;
7
8
  step: messages.PickleStep;
8
9
  stepDefinition: IDefinition;
9
10
  world: any;
10
11
  }
11
- export declare function run({ defaultTimeout, hookParameter, step, stepDefinition, world, }: IRunOptions): Promise<messages.TestStepResult>;
12
+ export declare function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }: IRunOptions): Promise<messages.TestStepResult>;
12
13
  declare const _default: {
13
14
  run: typeof run;
14
15
  };
@@ -30,10 +30,10 @@ exports.run = void 0;
30
30
  const time_1 = __importDefault(require("../time"));
31
31
  const user_code_runner_1 = __importDefault(require("../user_code_runner"));
32
32
  const messages = __importStar(require("@cucumber/messages"));
33
- const assertion_error_formatter_1 = require("assertion-error-formatter");
34
33
  const value_checker_1 = require("../value_checker");
34
+ const format_error_1 = require("./format_error");
35
35
  const { beginTiming, endTiming } = time_1.default;
36
- async function run({ defaultTimeout, hookParameter, step, stepDefinition, world, }) {
36
+ async function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }) {
37
37
  beginTiming();
38
38
  let error, result, invocationData;
39
39
  try {
@@ -72,7 +72,7 @@ async function run({ defaultTimeout, hookParameter, step, stepDefinition, world,
72
72
  status = messages.TestStepResultStatus.PENDING;
73
73
  }
74
74
  else if ((0, value_checker_1.doesHaveValue)(error)) {
75
- message = (0, assertion_error_formatter_1.format)(error);
75
+ message = (0, format_error_1.formatError)(error, filterStackTraces);
76
76
  status = messages.TestStepResultStatus.FAILED;
77
77
  }
78
78
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA0B;AAC1B,2EAAgD;AAChD,6DAA8C;AAC9C,yEAAkD;AAGlD,oDAIyB;AAEzB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,cAAI,CAAA;AAUhC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,WAAW,EAAE,CAAA;IACb,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI;QACF,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;YAC5D,aAAa;YACb,IAAI;YACJ,KAAK;SACN,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,CAAA;KAC9C;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,OAAO;KACR,CAAA;AACH,CAAC;AA3DD,kBA2DC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import Time from '../time'\nimport UserCodeRunner from '../user_code_runner'\nimport * as messages from '@cucumber/messages'\nimport { format } from 'assertion-error-formatter'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\n\nconst { beginTiming, endTiming } = Time\n\nexport interface IRunOptions {\n defaultTimeout: number\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n beginTiming()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = messages.TimeConversion.millisecondsToDuration(endTiming())\n let status: messages.TestStepResultStatus\n let message: string\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n message = format(error)\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n return {\n duration,\n status,\n message,\n }\n}\n\nexport default { run }\n"]}
1
+ {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA0B;AAC1B,2EAAgD;AAChD,6DAA8C;AAG9C,oDAIyB;AACzB,iDAA4C;AAE5C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,cAAI,CAAA;AAWhC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,WAAW,EAAE,CAAA;IACb,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI;QACF,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;YAC5D,aAAa;YACb,IAAI;YACJ,KAAK;SACN,CAAC,CAAA;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,KAAK,GAAG,GAAG,CAAA;KACZ;IAED,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE;QAC3B,MAAM,qBAAqB,GAAG,IAAA,8BAAc,EAC1C,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf,CAAA;QAED,IAAI,cAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxE,MAAM,IAAI,GAAG,MAAM,0BAAc,CAAC,GAAG,CAAC;gBACpC,SAAS,EAAE,cAAc,CAAC,UAAU;gBACpC,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,KAAK;gBACd,qBAAqB;aACtB,CAAC,CAAA;YACF,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;YAClB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;SACrB;aAAM;YACL,KAAK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;SACrD;KACF;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,SAAS,EAAE,CAAC,CAAA;IAC5E,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAe,CAAA;IACnB,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE;QAC/B,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;QAC/C,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;SAAM;QACL,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,OAAO;KACR,CAAA;AACH,CAAC;AA5DD,kBA4DC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import Time from '../time'\nimport UserCodeRunner from '../user_code_runner'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { formatError } from './format_error'\n\nconst { beginTiming, endTiming } = Time\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n beginTiming()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = messages.TimeConversion.millisecondsToDuration(endTiming())\n let status: messages.TestStepResultStatus\n let message: string\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n message = formatError(error, filterStackTraces)\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n return {\n duration,\n status,\n message,\n }\n}\n\nexport default { run }\n"]}
@@ -16,6 +16,7 @@ export interface INewTestCaseRunnerOptions {
16
16
  testCase: messages.TestCase;
17
17
  retries: number;
18
18
  skip: boolean;
19
+ filterStackTraces: boolean;
19
20
  supportCodeLibrary: ISupportCodeLibrary;
20
21
  worldParameters: any;
21
22
  }
@@ -31,11 +32,12 @@ export default class TestCaseRunner {
31
32
  private readonly testCase;
32
33
  private readonly maxAttempts;
33
34
  private readonly skip;
35
+ private readonly filterStackTraces;
34
36
  private readonly supportCodeLibrary;
35
37
  private testStepResults;
36
38
  private world;
37
39
  private readonly worldParameters;
38
- constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries, skip, supportCodeLibrary, worldParameters, }: INewTestCaseRunnerOptions);
40
+ constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters, }: INewTestCaseRunnerOptions);
39
41
  resetTestProgressData(): void;
40
42
  getBeforeStepHookDefinitions(): TestStepHookDefinition[];
41
43
  getAfterStepHookDefinitions(): TestStepHookDefinition[];
@@ -45,6 +47,7 @@ export default class TestCaseRunner {
45
47
  shouldSkipHook(isBeforeHook: boolean): boolean;
46
48
  aroundTestStep(testStepId: string, runStepFn: () => Promise<messages.TestStepResult>): Promise<void>;
47
49
  run(): Promise<messages.TestStepResultStatus>;
50
+ runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise<boolean>;
48
51
  runHook(hookDefinition: TestCaseHookDefinition, hookParameter: ITestCaseHookParameter, isBeforeHook: boolean): Promise<messages.TestStepResult>;
49
52
  runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: messages.PickleStep, stepResult?: messages.TestStepResult): Promise<messages.TestStepResult[]>;
50
53
  runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<messages.TestStepResult>;