@cucumber/cucumber 8.9.0 → 8.10.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.
package/README.md CHANGED
@@ -37,15 +37,22 @@ $ npm install @cucumber/cucumber
37
37
 
38
38
  Let's take this example of something to test:
39
39
 
40
+
41
+ First, write your main code in `src/index.js`:
42
+
40
43
  ```js
41
44
  class Greeter {
42
45
  sayHello() {
43
46
  return 'hello'
44
47
  }
45
48
  }
49
+
50
+ module.exports = {
51
+ Greeter
52
+ }
46
53
  ```
47
54
 
48
- First, write your feature in `features/greeting.feature`:
55
+ Then, write your feature in `features/greeting.feature`:
49
56
 
50
57
  ```gherkin
51
58
  Feature: Greeting
@@ -81,7 +88,7 @@ And see the output:
81
88
 
82
89
  ![Terminal output showing a successful test run with 1 scenario and 2 steps, all passing](./docs/images/readme-output.png)
83
90
 
84
- If you learn best by example, we have [a repo with several example projects](https://github.com/cucumber-examples/cucumber-js-examples), that might help you get going.
91
+ If you learn best by example, we have [a repo with several example projects](https://github.com/cucumber/cucumber-js-examples), that might help you get going.
85
92
 
86
93
  ## Documentation
87
94
 
@@ -9,7 +9,11 @@ const url_1 = require("url");
9
9
  // eslint-disable-next-line @typescript-eslint/no-var-requires
10
10
  const { importer } = require('../importer');
11
11
  async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }) {
12
- support_code_library_builder_1.default.reset(cwd, newId);
12
+ support_code_library_builder_1.default.reset(cwd, newId, {
13
+ requireModules,
14
+ requirePaths,
15
+ importPaths,
16
+ });
13
17
  requireModules.map((module) => require(module));
14
18
  requirePaths.map((path) => require(path));
15
19
  for (const path of importPaths) {
@@ -1 +1 @@
1
- {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAEA,mGAAuE;AACvE,6BAAmC;AAEnC,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3C,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/C,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACpC;IACD,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AApBD,sDAoBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport { pathToFileURL } from 'url'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<ISupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId)\n requireModules.map((module) => require(module))\n requirePaths.map((path) => require(path))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAEA,mGAAuE;AACvE,6BAAmC;AAEnC,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IACF,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/C,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACpC;IACD,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AAxBD,sDAwBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport { pathToFileURL } from 'url'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<ISupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n })\n requireModules.map((module) => require(module))\n requirePaths.map((path) => require(path))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { IRunEnvironment } from './types';
2
+ export declare function setupEnvironment(): Promise<Partial<IRunEnvironment>>;
3
+ export declare function teardownEnvironment(environment: IRunEnvironment): Promise<void>;
@@ -0,0 +1,33 @@
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.teardownEnvironment = exports.setupEnvironment = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = __importDefault(require("mz/fs"));
9
+ const reindent_template_literals_1 = require("reindent-template-literals");
10
+ const stream_1 = require("stream");
11
+ const messages_1 = require("@cucumber/messages");
12
+ const newId = messages_1.IdGenerator.uuid();
13
+ async function setupEnvironment() {
14
+ const cwd = path_1.default.join(__dirname, '..', '..', 'tmp', `api_${newId()}`);
15
+ await fs_1.default.mkdir(path_1.default.join(cwd, 'features'), { recursive: true });
16
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'features', 'test.feature'), (0, reindent_template_literals_1.reindent)(`Feature: test fixture
17
+ Scenario: one
18
+ Given a step
19
+ Then another step`));
20
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'features', 'steps.ts'), (0, reindent_template_literals_1.reindent)(`import { Given, Then } from '../../../src'
21
+ Given('a step', function () {})
22
+ Then('another step', function () {})`));
23
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'cucumber.mjs'), `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`);
24
+ const stdout = new stream_1.PassThrough();
25
+ return { cwd, stdout };
26
+ }
27
+ exports.setupEnvironment = setupEnvironment;
28
+ async function teardownEnvironment(environment) {
29
+ await fs_1.default.rmdir(environment.cwd, { recursive: true });
30
+ environment.stdout.end();
31
+ }
32
+ exports.teardownEnvironment = teardownEnvironment;
33
+ //# sourceMappingURL=test_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AACvB,+CAAsB;AACtB,2EAAqD;AACrD,mCAAoC;AACpC,iDAAgD;AAEhD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;AAEzB,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,YAAE,CAAC,KAAK,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,CAAC,EAC1C,IAAA,qCAAQ,EAAC;;;0BAGa,CAAC,CACxB,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,EACtC,IAAA,qCAAQ,EAAC;;yCAE4B,CAAC,CACvC,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAC9B,wHAAwH,CACzH,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,oBAAW,EAAE,CAAA;IAChC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACxB,CAAC;AAtBD,4CAsBC;AAEM,KAAK,UAAU,mBAAmB,CAAC,WAA4B;IACpE,MAAM,YAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;AAC1B,CAAC;AAHD,kDAGC","sourcesContent":["import { IRunEnvironment } from './types'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { reindent } from 'reindent-template-literals'\nimport { PassThrough } from 'stream'\nimport { IdGenerator } from '@cucumber/messages'\n\nconst newId = IdGenerator.uuid()\n\nexport async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {\n const cwd = path.join(__dirname, '..', '..', 'tmp', `api_${newId()}`)\n await fs.mkdir(path.join(cwd, 'features'), { recursive: true })\n await fs.writeFile(\n path.join(cwd, 'features', 'test.feature'),\n reindent(`Feature: test fixture\n Scenario: one\n Given a step\n Then another step`)\n )\n await fs.writeFile(\n path.join(cwd, 'features', 'steps.ts'),\n reindent(`import { Given, Then } from '../../../src'\n Given('a step', function () {})\n Then('another step', function () {})`)\n )\n await fs.writeFile(\n path.join(cwd, 'cucumber.mjs'),\n `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`\n )\n const stdout = new PassThrough()\n return { cwd, stdout }\n}\n\nexport async function teardownEnvironment(environment: IRunEnvironment) {\n await fs.rmdir(environment.cwd, { recursive: true })\n environment.stdout.end()\n}\n"]}
@@ -117,7 +117,7 @@ export interface IRunConfiguration {
117
117
  /**
118
118
  * @public
119
119
  */
120
- export declare type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
120
+ export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
121
121
  /**
122
122
  * @public
123
123
  */
@@ -1,4 +1,4 @@
1
- declare type PackageJSON = {
1
+ type PackageJSON = {
2
2
  engines: {
3
3
  node: string;
4
4
  };
@@ -5,7 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fromFile = void 0;
7
7
  const string_argv_1 = __importDefault(require("string-argv"));
8
+ const fs_1 = __importDefault(require("fs"));
8
9
  const path_1 = __importDefault(require("path"));
10
+ const yaml_1 = __importDefault(require("yaml"));
11
+ const util_1 = require("util");
9
12
  const url_1 = require("url");
10
13
  const merge_configurations_1 = require("./merge_configurations");
11
14
  const argv_parser_1 = __importDefault(require("./argv_parser"));
@@ -33,18 +36,29 @@ async function fromFile(logger, cwd, file, profiles = []) {
33
36
  exports.fromFile = fromFile;
34
37
  async function loadFile(cwd, file) {
35
38
  const filePath = path_1.default.join(cwd, file);
39
+ const extension = path_1.default.extname(filePath);
36
40
  let definitions;
37
- try {
38
- // eslint-disable-next-line @typescript-eslint/no-var-requires
39
- definitions = require(filePath);
40
- }
41
- catch (error) {
42
- if (error.code === 'ERR_REQUIRE_ESM') {
43
- definitions = await importer((0, url_1.pathToFileURL)(filePath));
44
- }
45
- else {
46
- throw error;
47
- }
41
+ switch (extension) {
42
+ case '.json':
43
+ definitions = JSON.parse(await (0, util_1.promisify)(fs_1.default.readFile)(filePath, { encoding: 'utf-8' }));
44
+ break;
45
+ case '.yaml':
46
+ case '.yml':
47
+ definitions = yaml_1.default.parse(await (0, util_1.promisify)(fs_1.default.readFile)(filePath, { encoding: 'utf-8' }));
48
+ break;
49
+ default:
50
+ try {
51
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
52
+ definitions = require(filePath);
53
+ }
54
+ catch (error) {
55
+ if (error.code === 'ERR_REQUIRE_ESM') {
56
+ definitions = await importer((0, url_1.pathToFileURL)(filePath));
57
+ }
58
+ else {
59
+ throw error;
60
+ }
61
+ }
48
62
  }
49
63
  if (typeof definitions !== 'object') {
50
64
  throw new Error(`Configuration file ${filePath} does not export an object`);
@@ -1 +1 @@
1
- {"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AACpC,gDAAuB;AACvB,6BAAmC;AAEnC,iEAA4D;AAC5D,gEAAsC;AACtC,iDAA4C;AAG5C,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,QAAQ,CAC5B,MAAe,EACf,GAAW,EACX,IAAY,EACZ,WAAqB,EAAE;IAEvB,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,IAAI,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IACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,4BAA4B,CAAC,CAAA;KAC5E;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAe,EACf,IAAY,EACZ,UAAe;IAEf,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,sCAAsC,CAAC,CAAA;QACpE,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,IAAA,qBAAU,EAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI;QACF,OAAO,IAAA,0BAAW,EAAC,UAAU,CAAC,CAAA;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,+BAA+B,KAAK,CAAC,MAAM,CAAC,IAAI,CACxE,GAAG,CACJ,EAAE,CACJ,CAAA;KACF;AACH,CAAC","sourcesContent":["import stringArgv from 'string-argv'\nimport path from 'path'\nimport { pathToFileURL } from 'url'\nimport { IConfiguration } from './types'\nimport { mergeConfigurations } from './merge_configurations'\nimport ArgvParser from './argv_parser'\nimport { checkSchema } from './check_schema'\nimport { ILogger } from '../logger'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function fromFile(\n logger: ILogger,\n cwd: string,\n file: string,\n profiles: string[] = []\n): Promise<Partial<IConfiguration>> {\n const definitions = await loadFile(cwd, file)\n if (!definitions.default) {\n logger.debug('No default profile defined in configuration file')\n definitions.default = {}\n }\n if (profiles.length < 1) {\n logger.debug('No profiles specified; using default profile')\n profiles = ['default']\n }\n const definedKeys = Object.keys(definitions)\n profiles.forEach((profileKey) => {\n if (!definedKeys.includes(profileKey)) {\n throw new Error(`Requested profile \"${profileKey}\" doesn't exist`)\n }\n })\n return mergeConfigurations(\n {},\n ...profiles.map((profileKey) =>\n extractConfiguration(logger, profileKey, definitions[profileKey])\n )\n )\n}\n\nasync function loadFile(\n cwd: string,\n file: string\n): Promise<Record<string, any>> {\n const filePath: string = path.join(cwd, file)\n let definitions\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n definitions = await importer(pathToFileURL(filePath))\n } else {\n throw error\n }\n }\n if (typeof definitions !== 'object') {\n throw new Error(`Configuration file ${filePath} does not export an object`)\n }\n return definitions\n}\n\nfunction extractConfiguration(\n logger: ILogger,\n name: string,\n definition: any\n): Partial<IConfiguration> {\n if (typeof definition === 'string') {\n logger.debug(`Profile \"${name}\" value is a string; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...stringArgv(definition),\n ])\n return configuration\n }\n try {\n return checkSchema(definition)\n } catch (error) {\n throw new Error(\n `Requested profile \"${name}\" failed schema validation: ${error.errors.join(\n ' '\n )}`\n )\n }\n}\n"]}
1
+ {"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AACpC,4CAAmB;AACnB,gDAAuB;AACvB,gDAAuB;AACvB,+BAAgC;AAChC,6BAAmC;AAEnC,iEAA4D;AAC5D,gEAAsC;AACtC,iDAA4C;AAG5C,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,QAAQ,CAC5B,MAAe,EACf,GAAW,EACX,IAAY,EACZ,WAAqB,EAAE;IAEvB,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;QACxB,MAAM,CAAC,KAAK,CAAC,kDAAkD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gBAAS,EAAC,YAAE,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAC9D,CAAA;YACD,MAAK;QACP;YACE,IAAI;gBACF,8DAA8D;gBAC9D,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;aAChC;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE;oBACpC,WAAW,GAAG,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAC,CAAA;iBACtD;qBAAM;oBACL,MAAM,KAAK,CAAA;iBACZ;aACF;KACJ;IACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,4BAA4B,CAAC,CAAA;KAC5E;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAe,EACf,IAAY,EACZ,UAAe;IAEf,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,sCAAsC,CAAC,CAAA;QACpE,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,IAAA,qBAAU,EAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI;QACF,OAAO,IAAA,0BAAW,EAAC,UAAU,CAAC,CAAA;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,+BAA+B,KAAK,CAAC,MAAM,CAAC,IAAI,CACxE,GAAG,CACJ,EAAE,CACJ,CAAA;KACF;AACH,CAAC","sourcesContent":["import stringArgv from 'string-argv'\nimport fs from 'fs'\nimport path from 'path'\nimport YAML from 'yaml'\nimport { promisify } from 'util'\nimport { pathToFileURL } from 'url'\nimport { IConfiguration } from './types'\nimport { mergeConfigurations } from './merge_configurations'\nimport ArgvParser from './argv_parser'\nimport { checkSchema } from './check_schema'\nimport { ILogger } from '../logger'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function fromFile(\n logger: ILogger,\n cwd: string,\n file: string,\n profiles: string[] = []\n): Promise<Partial<IConfiguration>> {\n const definitions = await loadFile(cwd, file)\n if (!definitions.default) {\n logger.debug('No default profile defined in configuration file')\n definitions.default = {}\n }\n if (profiles.length < 1) {\n logger.debug('No profiles specified; using default profile')\n profiles = ['default']\n }\n const definedKeys = Object.keys(definitions)\n profiles.forEach((profileKey) => {\n if (!definedKeys.includes(profileKey)) {\n throw new Error(`Requested profile \"${profileKey}\" doesn't exist`)\n }\n })\n return mergeConfigurations(\n {},\n ...profiles.map((profileKey) =>\n extractConfiguration(logger, profileKey, definitions[profileKey])\n )\n )\n}\n\nasync function loadFile(\n cwd: string,\n file: string\n): Promise<Record<string, any>> {\n const filePath: string = path.join(cwd, file)\n const extension = path.extname(filePath)\n let definitions\n switch (extension) {\n case '.json':\n definitions = JSON.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.yaml':\n case '.yml':\n definitions = YAML.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n default:\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n definitions = await importer(pathToFileURL(filePath))\n } else {\n throw error\n }\n }\n }\n if (typeof definitions !== 'object') {\n throw new Error(`Configuration file ${filePath} does not export an object`)\n }\n return definitions\n}\n\nfunction extractConfiguration(\n logger: ILogger,\n name: string,\n definition: any\n): Partial<IConfiguration> {\n if (typeof definition === 'string') {\n logger.debug(`Profile \"${name}\" value is a string; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...stringArgv(definition),\n ])\n return configuration\n }\n try {\n return checkSchema(definition)\n } catch (error) {\n throw new Error(\n `Requested profile \"${name}\" failed schema validation: ${error.errors.join(\n ' '\n )}`\n )\n }\n}\n"]}
@@ -11,6 +11,8 @@ const DEFAULT_FILENAMES = [
11
11
  'cucumber.cjs',
12
12
  'cucumber.mjs',
13
13
  'cucumber.json',
14
+ 'cucumber.yaml',
15
+ 'cucumber.yml',
14
16
  ];
15
17
  function locateFile(cwd) {
16
18
  return DEFAULT_FILENAMES.find((filename) => fs_1.default.existsSync(path_1.default.join(cwd, filename)));
@@ -1 +1 @@
1
- {"version":3,"file":"locate_file.js","sourceRoot":"","sources":["../../src/configuration/locate_file.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAsB;AACtB,gDAAuB;AAEvB,MAAM,iBAAiB,GAAG;IACxB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;CAChB,CAAA;AAED,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CACxC,CAAA;AACH,CAAC;AAJD,gCAIC","sourcesContent":["import fs from 'mz/fs'\nimport path from 'path'\n\nconst DEFAULT_FILENAMES = [\n 'cucumber.js',\n 'cucumber.cjs',\n 'cucumber.mjs',\n 'cucumber.json',\n]\n\nexport function locateFile(cwd: string): string | undefined {\n return DEFAULT_FILENAMES.find((filename) =>\n fs.existsSync(path.join(cwd, filename))\n )\n}\n"]}
1
+ {"version":3,"file":"locate_file.js","sourceRoot":"","sources":["../../src/configuration/locate_file.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAsB;AACtB,gDAAuB;AAEvB,MAAM,iBAAiB,GAAG;IACxB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,eAAe;IACf,cAAc;CACf,CAAA;AAED,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CACxC,CAAA;AACH,CAAC;AAJD,gCAIC","sourcesContent":["import fs from 'mz/fs'\nimport path from 'path'\n\nconst DEFAULT_FILENAMES = [\n 'cucumber.js',\n 'cucumber.cjs',\n 'cucumber.mjs',\n 'cucumber.json',\n 'cucumber.yaml',\n 'cucumber.yml',\n]\n\nexport function locateFile(cwd: string): string | undefined {\n return DEFAULT_FILENAMES.find((filename) =>\n fs.existsSync(path.join(cwd, filename))\n )\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import { TestStepResultStatus } from '@cucumber/messages';
4
4
  import { Writable } from 'stream';
5
- export declare type IColorFn = (text: string) => string;
5
+ export type IColorFn = (text: string) => string;
6
6
  export interface IColorFns {
7
7
  forStatus: (status: TestStepResultStatus) => IColorFn;
8
8
  location: IColorFn;
@@ -22,14 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.formatSummary = void 0;
30
- const duration_1 = __importDefault(require("duration"));
31
27
  const messages = __importStar(require("@cucumber/messages"));
32
28
  const value_checker_1 = require("../../value_checker");
29
+ const luxon_1 = require("luxon");
33
30
  const STATUS_REPORT_ORDER = [
34
31
  messages.TestStepResultStatus.FAILED,
35
32
  messages.TestStepResultStatus.AMBIGUOUS,
@@ -89,8 +86,11 @@ function getCountSummary({ colorFns, objects, type, }) {
89
86
  function getDurationSummary(durationMsg) {
90
87
  const start = new Date(0);
91
88
  const end = new Date(messages.TimeConversion.durationToMilliseconds(durationMsg));
92
- const duration = new duration_1.default(start, end);
93
- // Use spaces in toString method for readability and to avoid %Ls which is a format
94
- return duration.toString('%Ms m %S . %L s').replace(/ /g, '');
89
+ const duration = luxon_1.Interval.fromDateTimes(start, end).toDuration([
90
+ 'minutes',
91
+ 'seconds',
92
+ 'milliseconds',
93
+ ]);
94
+ return duration.toFormat("m'm'ss.SSS's'");
95
95
  }
96
96
  //# sourceMappingURL=summary_helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA+B;AAG/B,6DAA8C;AAC9C,uDAAmD;AAEnD,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,oBAAoB,CAAC,MAAM;IACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;CACrC,CAAA;AAQD,SAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,GACO;IACtB,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,IAAI,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAA;IACzE,gBAAgB,CAAC,OAAO,CACtB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;QAChE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAChD,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CACtD,iBAAiB,EACjB,UAAU,CAAC,Q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{ ITestCaseAttempt } from './event_data_collector'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nconst STATUS_REPORT_ORDER = [\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.UNDEFINED,\n messages.TestStepResultStatus.PENDING,\n messages.TestStepResultStatus.SKIPPED,\n messages.TestStepResultStatus.PASSED,\n]\n\nexport interface IFormatSummaryRequest {\n colorFns: IColorFns\n testCaseAttempts: ITestCaseAttempt[]\n testRunDuration: messages.Duration\n}\n\nexport function formatSummary({\n colorFns,\n testCaseAttempts,\n testRunDuration,\n}: IFormatSummaryRequest): string {\n const testCaseResults: messages.TestStepResult[] = []\n const testStepResults: messages.TestStepResult[] = []\n let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0)\n testCaseAttempts.forEach(\n ({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = messages.TimeConversion.addDurations(\n totalStepDuration,\n stepResult.duration\n )\n })\n if (!willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n testCase.testSteps.forEach((testStep) => {\n if (doesHaveValue(testStep.pickleStepId)) {\n testStepResults.push(stepResults[testStep.id])\n }\n })\n }\n }\n )\n const scenarioSummary = getCountSummary({\n colorFns,\n objects: testCaseResults,\n type: 'scenario',\n })\n const stepSummary = getCountSummary({\n colorFns,\n objects: testStepResults,\n type: 'step',\n })\n const durationSummary = `${getDurationSummary(\n testRunDuration\n )} (executing steps: ${getDurationSummary(totalStepDuration)})\\n`\n return [scenarioSummary, stepSummary, durationSummary].join('\\n')\n}\n\ninterface IGetCountSummaryRequest {\n colorFns: IColorFns\n objects: messages.TestStepResult[]\n type: string\n}\n\nfunction getCountSummary({\n colorFns,\n objects,\n type,\n}: IGetCountSummaryRequest): string {\n const counts: Record<string, number> = {}\n STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0))\n objects.forEach((x) => (counts[x.status] += 1))\n const total = Object.values(counts).reduce((acc, x) => acc + x, 0)\n let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`\n if (total > 0) {\n const details: string[] = []\n STATUS_REPORT_ORDER.forEach((status) => {\n if (counts[status] > 0) {\n details.push(\n colorFns.forStatus(status)(\n `${counts[status].toString()} ${status.toLowerCase()}`\n )\n )\n }\n })\n text += ` (${details.join(', ')})`\n }\n return text\n}\n\nfunction getDurationSummary(durationMsg: messages.Duration): string {\n const start = new Date(0)\n const end = new Date(\n messages.TimeConversion.durationToMilliseconds(durationMsg)\n )\n const duration = new Duration(start, end)\n // Use spaces in toString method for readability and to avoid %Ls which is a format\n return duration.toString('%Ms m %S . %L s').replace(/ /g, '')\n}\n"]}
1
+ {"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6DAA8C;AAC9C,uDAAmD;AACnD,iCAAgC;AAEhC,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,oBAAoB,CAAC,MAAM;IACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;CACrC,CAAA;AAQD,SAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,GACO;IACtB,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,IAAI,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAA;IACzE,gBAAgB,CAAC,OAAO,CACtB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;Q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CAAC;QAC7D,SAAS;QACT,SAAS;QACT,cAAc;KACf,CAAC,CAAA;IACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import { IColorFns } from '../get_color_fns'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\nimport { Interval } from 'luxon'\n\nconst STATUS_REPORT_ORDER = [\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.UNDEFINED,\n messages.TestStepResultStatus.PENDING,\n messages.TestStepResultStatus.SKIPPED,\n messages.TestStepResultStatus.PASSED,\n]\n\nexport interface IFormatSummaryRequest {\n colorFns: IColorFns\n testCaseAttempts: ITestCaseAttempt[]\n testRunDuration: messages.Duration\n}\n\nexport function formatSummary({\n colorFns,\n testCaseAttempts,\n testRunDuration,\n}: IFormatSummaryRequest): string {\n const testCaseResults: messages.TestStepResult[] = []\n const testStepResults: messages.TestStepResult[] = []\n let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0)\n testCaseAttempts.forEach(\n ({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = messages.TimeConversion.addDurations(\n totalStepDuration,\n stepResult.duration\n )\n })\n if (!willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n testCase.testSteps.forEach((testStep) => {\n if (doesHaveValue(testStep.pickleStepId)) {\n testStepResults.push(stepResults[testStep.id])\n }\n })\n }\n }\n )\n const scenarioSummary = getCountSummary({\n colorFns,\n objects: testCaseResults,\n type: 'scenario',\n })\n const stepSummary = getCountSummary({\n colorFns,\n objects: testStepResults,\n type: 'step',\n })\n const durationSummary = `${getDurationSummary(\n testRunDuration\n )} (executing steps: ${getDurationSummary(totalStepDuration)})\\n`\n return [scenarioSummary, stepSummary, durationSummary].join('\\n')\n}\n\ninterface IGetCountSummaryRequest {\n colorFns: IColorFns\n objects: messages.TestStepResult[]\n type: string\n}\n\nfunction getCountSummary({\n colorFns,\n objects,\n type,\n}: IGetCountSummaryRequest): string {\n const counts: Record<string, number> = {}\n STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0))\n objects.forEach((x) => (counts[x.status] += 1))\n const total = Object.values(counts).reduce((acc, x) => acc + x, 0)\n let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`\n if (total > 0) {\n const details: string[] = []\n STATUS_REPORT_ORDER.forEach((status) => {\n if (counts[status] > 0) {\n details.push(\n colorFns.forStatus(status)(\n `${counts[status].toString()} ${status.toLowerCase()}`\n )\n )\n }\n })\n text += ` (${details.join(', ')})`\n }\n return text\n}\n\nfunction getDurationSummary(durationMsg: messages.Duration): string {\n const start = new Date(0)\n const end = new Date(\n messages.TimeConversion.durationToMilliseconds(durationMsg)\n )\n const duration = Interval.fromDateTimes(start, end).toDuration([\n 'minutes',\n 'seconds',\n 'milliseconds',\n ])\n return duration.toFormat(\"m'm'ss.SSS's'\")\n}\n"]}
@@ -22,9 +22,9 @@ export interface IPublishConfig {
22
22
  url: string;
23
23
  token: string;
24
24
  }
25
- export declare type IFormatterStream = Writable;
26
- export declare type IFormatterLogFn = (buffer: string | Uint8Array) => void;
27
- export declare type IFormatterCleanupFn = () => Promise<any>;
25
+ export type IFormatterStream = Writable;
26
+ export type IFormatterLogFn = (buffer: string | Uint8Array) => void;
27
+ export type IFormatterCleanupFn = () => Promise<any>;
28
28
  export interface IFormatterOptions {
29
29
  colorFns: IColorFns;
30
30
  cwd: string;
@@ -1 +1 @@
1
- export declare type GherkinStepKeyword = 'Unknown' | 'Given' | 'When' | 'Then';
1
+ export type GherkinStepKeyword = 'Unknown' | 'Given' | 'When' | 'Then';
@@ -1 +1 @@
1
- export declare type PickleOrder = 'defined' | 'random' | string;
1
+ export type PickleOrder = 'defined' | 'random' | string;
@@ -10,5 +10,5 @@ export interface PluginContext {
10
10
  configuration: IRunOptions;
11
11
  environment: IRunEnvironment;
12
12
  }
13
- export declare type PluginCleanup = () => any | void | Promise<any | void>;
14
- export declare type Plugin = (context: PluginContext) => Promise<PluginCleanup | void>;
13
+ export type PluginCleanup = () => any | void | Promise<any | void>;
14
+ export type Plugin = (context: PluginContext) => Promise<PluginCleanup | void>;
@@ -3,7 +3,7 @@
3
3
  /// <reference types="node" />
4
4
  import { Transform } from 'stream';
5
5
  import http from 'http';
6
- declare type HttpMethod = 'GET' | 'POST' | 'PUT';
6
+ type HttpMethod = 'GET' | 'POST' | 'PUT';
7
7
  /**
8
8
  * This Writable writes data to a HTTP/HTTPS URL.
9
9
  *
@@ -10,9 +10,9 @@ export interface IAttachment {
10
10
  data: string;
11
11
  media: IAttachmentMedia;
12
12
  }
13
- export declare type IAttachFunction = (attachment: IAttachment) => void;
14
- export declare type ICreateAttachment = (data: Buffer | Readable | string, mediaType?: string, callback?: () => void) => void | Promise<void>;
15
- export declare type ICreateLog = (text: string) => void | Promise<void>;
13
+ export type IAttachFunction = (attachment: IAttachment) => void;
14
+ export type ICreateAttachment = (data: Buffer | Readable | string, mediaType?: string, callback?: () => void) => void | Promise<void>;
15
+ export type ICreateLog = (text: string) => void | Promise<void>;
16
16
  export default class AttachmentManager {
17
17
  private readonly onAttachment;
18
18
  constructor(onAttachment: IAttachFunction);
@@ -1,6 +1,6 @@
1
1
  import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun } from './command_types';
2
- declare type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
3
- declare type IMessageSender = (command: ICoordinatorReport) => void;
2
+ type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
3
+ type IMessageSender = (command: ICoordinatorReport) => void;
4
4
  export default class Worker {
5
5
  private readonly cwd;
6
6
  private readonly exit;
@@ -32,7 +32,11 @@ class Worker {
32
32
  });
33
33
  }
34
34
  async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }) {
35
- support_code_library_builder_1.default.reset(this.cwd, this.newId);
35
+ support_code_library_builder_1.default.reset(this.cwd, this.newId, {
36
+ requireModules,
37
+ requirePaths,
38
+ importPaths,
39
+ });
36
40
  requireModules.map((module) => require(module));
37
41
  requirePaths.map((module) => require(module));
38
42
  for (const path of importPaths) {
@@ -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,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;I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AC,CAAC,CAAC,CAAA;IACd,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAuB;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"]}
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,MA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C;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;AAtHD,yBAsHC","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,\n requirePaths,\n importPaths,\n })\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"]}
@@ -1,3 +1,3 @@
1
1
  import TestRunHookDefinition from '../models/test_run_hook_definition';
2
- export declare type RunsTestRunHooks = (definitions: TestRunHookDefinition[], name: string) => Promise<void>;
2
+ export type RunsTestRunHooks = (definitions: TestRunHookDefinition[], name: string) => Promise<void>;
3
3
  export declare const makeRunTestRunHooks: (dryRun: boolean, defaultTimeout: number, errorMessage: (name: string, location: string) => string) => RunsTestRunHooks;
@@ -5,8 +5,8 @@ import TestRunHookDefinition from '../models/test_run_hook_definition';
5
5
  import StepDefinition from '../models/step_definition';
6
6
  import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions';
7
7
  import { IWorld } from './world';
8
- export declare type DefineStepPattern = string | RegExp;
9
- export declare type ParallelAssignmentValidator = (pickle: messages.Pickle, runningPickles: messages.Pickle[]) => boolean;
8
+ export type DefineStepPattern = string | RegExp;
9
+ export type ParallelAssignmentValidator = (pickle: messages.Pickle, runningPickles: messages.Pickle[]) => boolean;
10
10
  export interface ITestCaseHookParameter {
11
11
  gherkinDocument: messages.GherkinDocument;
12
12
  pickle: messages.Pickle;
@@ -22,9 +22,9 @@ export interface ITestStepHookParameter {
22
22
  testCaseStartedId: string;
23
23
  testStepId: string;
24
24
  }
25
- export declare type TestCaseHookFunction<WorldType> = (this: WorldType, arg: ITestCaseHookParameter) => any | Promise<any>;
26
- export declare type TestStepHookFunction<WorldType> = (this: WorldType, arg: ITestStepHookParameter) => any | Promise<any>;
27
- export declare type TestStepFunction<WorldType> = (this: WorldType, ...args: any[]) => any | Promise<any>;
25
+ export type TestCaseHookFunction<WorldType> = (this: WorldType, arg: ITestCaseHookParameter) => any | Promise<any>;
26
+ export type TestStepHookFunction<WorldType> = (this: WorldType, arg: ITestStepHookParameter) => any | Promise<any>;
27
+ export type TestStepFunction<WorldType> = (this: WorldType, ...args: any[]) => any | Promise<any>;
28
28
  export interface IDefineStepOptions {
29
29
  timeout?: number;
30
30
  wrapperOptions?: any;
@@ -48,7 +48,7 @@ export interface IParameterTypeDefinition<T> {
48
48
  useForSnippets?: boolean;
49
49
  preferForRegexpMatch?: boolean;
50
50
  }
51
- export declare type IDefineStep = (<WorldType = IWorld>(pattern: DefineStepPattern, code: TestStepFunction<WorldType>) => void) & (<WorldType = IWorld>(pattern: DefineStepPattern, options: IDefineStepOptions, code: TestStepFunction<WorldType>) => void);
51
+ export type IDefineStep = (<WorldType = IWorld>(pattern: DefineStepPattern, code: TestStepFunction<WorldType>) => void) & (<WorldType = IWorld>(pattern: DefineStepPattern, options: IDefineStepOptions, code: TestStepFunction<WorldType>) => void);
52
52
  export interface IDefineSupportCodeMethods {
53
53
  defineParameterType: (options: IParameterTypeDefinition<any>) => void;
54
54
  defineStep: IDefineStep;
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "8.9.0";
1
+ export declare const version = "8.10.0";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '8.9.0';
5
+ exports.version = '8.10.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '8.9.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '8.10.0'\n"]}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "8.9.0",
11
+ "version": "8.10.0",
12
12
  "homepage": "https://github.com/cucumber/cucumber-js",
13
13
  "author": "Julien Biezemans <jb@jbpros.com>",
14
14
  "contributors": [
@@ -197,11 +197,11 @@
197
197
  },
198
198
  "dependencies": {
199
199
  "@cucumber/ci-environment": "9.1.0",
200
- "@cucumber/cucumber-expressions": "16.0.0",
201
- "@cucumber/gherkin": "24.1.0",
200
+ "@cucumber/cucumber-expressions": "16.1.0",
201
+ "@cucumber/gherkin": "25.0.2",
202
202
  "@cucumber/gherkin-streams": "5.0.1",
203
- "@cucumber/gherkin-utils": "8.0.1",
204
- "@cucumber/html-formatter": "20.1.0",
203
+ "@cucumber/gherkin-utils": "8.0.2",
204
+ "@cucumber/html-formatter": "20.2.0",
205
205
  "@cucumber/message-streams": "4.0.1",
206
206
  "@cucumber/messages": "20.0.0",
207
207
  "@cucumber/tag-expressions": "4.1.0",
@@ -211,7 +211,6 @@
211
211
  "cli-table3": "0.6.3",
212
212
  "commander": "^9.0.0",
213
213
  "debug": "^4.3.4",
214
- "duration": "^0.2.2",
215
214
  "durations": "^3.4.2",
216
215
  "error-stack-parser": "^2.1.4",
217
216
  "figures": "^3.2.0",
@@ -223,6 +222,7 @@
223
222
  "knuth-shuffle-seeded": "^1.0.6",
224
223
  "lodash.merge": "^4.6.2",
225
224
  "lodash.mergewith": "^4.6.2",
225
+ "luxon": "^3.1.1",
226
226
  "mz": "^2.7.0",
227
227
  "progress": "^2.0.3",
228
228
  "resolve-pkg": "^2.0.0",
@@ -234,15 +234,16 @@
234
234
  "util-arity": "^1.1.0",
235
235
  "verror": "^1.10.0",
236
236
  "xmlbuilder": "^15.1.1",
237
+ "yaml": "1.10.2",
237
238
  "yup": "^0.32.11"
238
239
  },
239
240
  "devDependencies": {
240
241
  "@cucumber/compatibility-kit": "11.0.1",
241
- "@cucumber/query": "12.0.0",
242
- "@microsoft/api-documenter": "7.19.23",
243
- "@microsoft/api-extractor": "7.33.5",
244
- "@sinonjs/fake-timers": "9.1.2",
245
- "@types/chai": "4.3.3",
242
+ "@cucumber/query": "12.0.1",
243
+ "@microsoft/api-documenter": "7.19.25",
244
+ "@microsoft/api-extractor": "7.33.6",
245
+ "@sinonjs/fake-timers": "10.0.0",
246
+ "@types/chai": "4.3.4",
246
247
  "@types/chai-xml": "^0.3.2",
247
248
  "@types/debug": "4.1.7",
248
249
  "@types/dirty-chai": "2.0.2",
@@ -252,26 +253,27 @@
252
253
  "@types/has-ansi": "5.0.0",
253
254
  "@types/lodash.merge": "4.6.7",
254
255
  "@types/lodash.mergewith": "4.6.7",
255
- "@types/mocha": "10.0.0",
256
- "@types/mustache": "4.2.1",
256
+ "@types/luxon": "^3.1.0",
257
+ "@types/mocha": "10.0.1",
258
+ "@types/mustache": "4.2.2",
257
259
  "@types/mz": "2.7.4",
258
- "@types/node": "18.11.9",
260
+ "@types/node": "18.11.10",
259
261
  "@types/progress": "2.0.5",
260
262
  "@types/semver": "7.3.13",
261
- "@types/sinon-chai": "3.2.8",
263
+ "@types/sinon-chai": "3.2.9",
262
264
  "@types/sinonjs__fake-timers": "8.1.2",
263
265
  "@types/stream-buffers": "3.0.4",
264
266
  "@types/tmp": "0.2.3",
265
267
  "@types/verror": "1.10.6",
266
- "@typescript-eslint/eslint-plugin": "5.42.0",
267
- "@typescript-eslint/parser": "5.42.0",
268
- "chai": "4.3.6",
268
+ "@typescript-eslint/eslint-plugin": "5.45.0",
269
+ "@typescript-eslint/parser": "5.45.0",
270
+ "chai": "4.3.7",
269
271
  "chai-exclude": "2.1.0",
270
272
  "chai-xml": "^0.4.0",
271
273
  "coffeescript": "2.7.0",
272
274
  "dependency-lint": "7.1.0",
273
275
  "dirty-chai": "2.0.1",
274
- "eslint": "8.26.0",
276
+ "eslint": "8.28.0",
275
277
  "eslint-config-prettier": "8.5.0",
276
278
  "eslint-plugin-import": "2.26.0",
277
279
  "eslint-plugin-node": "11.1.0",
@@ -283,16 +285,16 @@
283
285
  "mocha": "10.1.0",
284
286
  "mustache": "4.2.0",
285
287
  "nyc": "15.1.0",
286
- "prettier": "2.7.1",
288
+ "prettier": "2.8.0",
287
289
  "reindent-template-literals": "1.1.0",
288
290
  "shx": "0.3.4",
289
- "sinon": "14.0.1",
291
+ "sinon": "15.0.0",
290
292
  "sinon-chai": "3.7.0",
291
293
  "stream-buffers": "3.0.2",
292
294
  "stream-to-string": "1.2.0",
293
295
  "ts-node": "10.9.1",
294
- "tsd": "0.24.1",
295
- "typescript": "4.8.4"
296
+ "tsd": "0.25.0",
297
+ "typescript": "4.9.3"
296
298
  },
297
299
  "overrides": {
298
300
  "ansi-regex": "^5.0.1"