Socket
Socket
Sign inDemoInstall

@cucumber/cucumber

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/cucumber - npm Package Compare versions

Comparing version 10.5.1 to 10.6.0

1

lib/api/convert_configuration.js

@@ -18,2 +18,3 @@ "use strict";

importPaths: flatConfiguration.import,
loaders: flatConfiguration.loader,
},

@@ -20,0 +21,0 @@ runtime: {

@@ -20,4 +20,10 @@ "use strict";

const newId = messages_1.IdGenerator.uuid();
const supportCoordinates = Object.assign({
requireModules: [],
requirePaths: [],
loaders: [],
importPaths: [],
}, options.support);
const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, options.support);
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
pluginManager.emit('paths:resolve', resolvedPaths);

@@ -29,4 +35,5 @@ const { requirePaths, importPaths } = resolvedPaths;

newId,
requireModules: options.support.requireModules,
requireModules: supportCoordinates.requireModules,
requirePaths,
loaders: supportCoordinates.loaders,
importPaths,

@@ -33,0 +40,0 @@ });

13

lib/api/run_cucumber.js

@@ -29,3 +29,8 @@ "use strict";

? options.support.originalCoordinates
: options.support;
: Object.assign({
requireModules: [],
requirePaths: [],
loaders: [],
importPaths: [],
}, options.support);
const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {

@@ -45,4 +50,5 @@ ...options,

requirePaths,
requireModules: supportCoordinates.requireModules,
importPaths,
requireModules: supportCoordinates.requireModules,
loaders: supportCoordinates.loaders,
});

@@ -108,5 +114,2 @@ const eventBroadcaster = new node_events_1.EventEmitter();

supportCodeLibrary,
requireModules: supportCoordinates.requireModules,
requirePaths,
importPaths,
options: options.runtime,

@@ -113,0 +116,0 @@ });

@@ -9,3 +9,3 @@ /// <reference types="node" />

import { IRunOptionsRuntime } from './types';
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }: {
cwd: string;

@@ -18,6 +18,3 @@ logger: ILogger;

supportCodeLibrary: SupportCodeLibrary;
requireModules: string[];
requirePaths: string[];
importPaths: string[];
options: IRunOptionsRuntime;
}): IRuntime;

@@ -9,3 +9,3 @@ "use strict";

const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }) {
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }) {
if (parallel > 0) {

@@ -21,5 +21,2 @@ return new coordinator_1.default({

supportCodeLibrary,
requireModules,
requirePaths,
importPaths,
numberOfWorkers: parallel,

@@ -26,0 +23,0 @@ });

import { IdGenerator } from '@cucumber/messages';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { ILogger } from '../logger';
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }: {
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }: {
logger: ILogger;

@@ -11,2 +11,3 @@ cwd: string;

importPaths: string[];
loaders: string[];
}): Promise<SupportCodeLibrary>;

@@ -7,6 +7,7 @@ "use strict";

exports.getSupportCodeLibrary = void 0;
const node_module_1 = require("node:module");
const node_url_1 = require("node:url");
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
const try_require_1 = __importDefault(require("../try_require"));
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }) {
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }) {
support_code_library_builder_1.default.reset(cwd, newId, {

@@ -16,2 +17,3 @@ requireModules,

importPaths,
loaders,
});

@@ -26,2 +28,6 @@ requireModules.map((path) => {

});
for (const specifier of loaders) {
logger.debug(`Attempting to register loader "${specifier}"`);
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
}
for (const path of importPaths) {

@@ -28,0 +34,0 @@ logger.debug(`Attempting to import code from "${path}"`);

@@ -147,2 +147,6 @@ /// <reference types="node" />

importPaths: string[];
/**
* Specifiers of loaders to register, via `register()`
*/
loaders: string[];
}

@@ -162,3 +166,3 @@ /**

sources: ISourcesCoordinates;
support: ISupportCodeCoordinates;
support: Partial<ISupportCodeCoordinates>;
}

@@ -242,3 +246,3 @@ /**

sources: ISourcesCoordinates;
support: ISupportCodeCoordinates;
support: Partial<ISupportCodeCoordinates>;
runtime: IRunOptionsRuntime;

@@ -271,3 +275,3 @@ formats: IRunOptionsFormats;

*/
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
export type ISupportCodeCoordinatesOrLibrary = Partial<ISupportCodeCoordinates> | ISupportCodeLibrary;
/**

@@ -274,0 +278,0 @@ * Options for {@link runCucumber}

@@ -67,2 +67,3 @@ "use strict";

.option('-i, --import <GLOB|DIR|FILE>', 'import files before executing features (repeatable)', ArgvParser.collect)
.option('-l, --loader <NODE_MODULE>', 'module specifier(s) for loaders to be registered ahead of loading support code', ArgvParser.collect)
.option('--language <ISO 639-1>', 'provide the default language for feature files')

@@ -69,0 +70,0 @@ .option('--name <REGEXP>', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect)

@@ -13,2 +13,3 @@ "use strict";

language: 'en',
loader: [],
name: [],

@@ -15,0 +16,0 @@ order: 'defined',

@@ -11,2 +11,3 @@ "use strict";

'import',
'loader',
'name',

@@ -13,0 +14,0 @@ 'paths',

@@ -77,2 +77,7 @@ import { JsonObject } from 'type-fest';

/**
* Module specifier(s) for loaders to be registered ahead of loading support code
* @default []
*/
loader: string[];
/**
* Regular expressions of which scenario names should match one of to be run

@@ -79,0 +84,0 @@ * @default []

@@ -11,2 +11,5 @@ "use strict";

}
if (configuration.loader.length && !configuration.import.length) {
logger.warn('Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
}
if (configuration.retryTagFilter && !configuration.retry) {

@@ -13,0 +16,0 @@ throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');

@@ -14,2 +14,3 @@ "use strict";

importPaths: [],
loaders: [],
}) {

@@ -16,0 +17,0 @@ const unexpandedSourcePaths = await getUnexpandedSourcePaths(cwd, sources.paths);

import * as messages from '@cucumber/messages';
import { Envelope } from '@cucumber/messages';
import { IRuntimeOptions } from '../index';
import { ISupportCodeCoordinates } from '../../api';
export interface IWorkerCommand {

@@ -9,6 +11,3 @@ initialize?: IWorkerCommandInitialize;

export interface IWorkerCommandInitialize {
filterStacktraces: boolean;
requireModules: string[];
requirePaths: string[];
importPaths: string[];
supportCodeCoordinates: ISupportCodeCoordinates;
supportCodeIds?: ICanonicalSupportCodeIds;

@@ -31,4 +30,4 @@ options: IRuntimeOptions;

export interface ICoordinatorReport {
jsonEnvelope?: string;
jsonEnvelope?: Envelope;
ready?: boolean;
}

@@ -21,5 +21,2 @@ /// <reference types="node" />

supportCodeLibrary: SupportCodeLibrary;
requireModules: string[];
requirePaths: string[];
importPaths: string[];
numberOfWorkers: number;

@@ -55,5 +52,2 @@ }

private readonly supportCodeLibrary;
private readonly requireModules;
private readonly requirePaths;
private readonly importPaths;
private readonly numberOfWorkers;

@@ -63,3 +57,3 @@ private readonly logger;

private idleInterventions;
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, numberOfWorkers, }: INewCoordinatorOptions);
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, numberOfWorkers, }: INewCoordinatorOptions);
parseWorkerMessage(worker: IWorker, message: ICoordinatorReport): void;

@@ -66,0 +60,0 @@ awakenWorkers(triggeringWorker: IWorker): void;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -31,3 +8,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

const node_path_1 = __importDefault(require("node:path"));
const messages = __importStar(require("@cucumber/messages"));
const helpers_1 = require("../helpers");

@@ -51,5 +27,2 @@ const value_checker_1 = require("../../value_checker");

supportCodeLibrary;
requireModules;
requirePaths;
importPaths;
numberOfWorkers;

@@ -59,3 +32,3 @@ logger;

idleInterventions;
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, numberOfWorkers, }) {
constructor({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, numberOfWorkers, }) {
this.cwd = cwd;

@@ -69,5 +42,2 @@ this.logger = logger;

this.supportCodeLibrary = supportCodeLibrary;
this.requireModules = requireModules;
this.requirePaths = requirePaths;
this.importPaths = importPaths;
this.pickleIds = Array.from(pickleIds);

@@ -86,3 +56,3 @@ this.numberOfWorkers = numberOfWorkers;

else if ((0, value_checker_1.doesHaveValue)(message.jsonEnvelope)) {
const envelope = messages.parseEnvelope(message.jsonEnvelope);
const envelope = message.jsonEnvelope;
this.eventBroadcaster.emit('envelope', envelope);

@@ -133,6 +103,3 @@ if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {

initialize: {
filterStacktraces: this.options.filterStacktraces,
requireModules: this.requireModules,
requirePaths: this.requirePaths,
importPaths: this.importPaths,
supportCodeCoordinates: this.supportCodeLibrary.originalCoordinates,
supportCodeIds: {

@@ -139,0 +106,0 @@ stepDefinitionIds: this.supportCodeLibrary.stepDefinitions.map((s) => s.id),

@@ -21,3 +21,3 @@ import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun } from './command_types';

});
initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }: IWorkerCommandInitialize): Promise<void>;
initialize({ supportCodeCoordinates, supportCodeIds, options, }: IWorkerCommandInitialize): Promise<void>;
finalize(): Promise<void>;

@@ -24,0 +24,0 @@ receiveMessage(message: IWorkerCommand): Promise<void>;

@@ -8,2 +8,3 @@ "use strict";

const node_url_1 = require("node:url");
const node_module_1 = require("node:module");
const messages_1 = require("@cucumber/messages");

@@ -36,18 +37,13 @@ const support_code_library_builder_1 = __importDefault(require("../../support_code_library_builder"));

this.eventBroadcaster.on('envelope', (envelope) => {
// assign `workerId` property only for the `testCaseStarted` message
if (envelope.testCaseStarted) {
envelope.testCaseStarted.workerId = this.id;
}
this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) });
this.sendMessage({ jsonEnvelope: envelope });
});
}
async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }) {
support_code_library_builder_1.default.reset(this.cwd, this.newId, {
requireModules,
requirePaths,
importPaths,
});
requireModules.map((module) => (0, try_require_1.default)(module));
requirePaths.map((module) => (0, try_require_1.default)(module));
for (const path of importPaths) {
async initialize({ supportCodeCoordinates, supportCodeIds, options, }) {
support_code_library_builder_1.default.reset(this.cwd, this.newId, supportCodeCoordinates);
supportCodeCoordinates.requireModules.map((module) => (0, try_require_1.default)(module));
supportCodeCoordinates.requirePaths.map((module) => (0, try_require_1.default)(module));
for (const specifier of supportCodeCoordinates.loaders) {
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
}
for (const path of supportCodeCoordinates.importPaths) {
await import((0, node_url_1.pathToFileURL)(path).toString());

@@ -57,3 +53,3 @@ }

this.worldParameters = options.worldParameters;
this.filterStacktraces = filterStacktraces;
this.filterStacktraces = options.filterStacktraces;
this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(options.dryRun, this.supportCodeLibrary.defaultTimeout, this.worldParameters, (name, location) => `${name} hook errored on worker ${this.id}, process exiting: ${location}`);

@@ -81,2 +77,3 @@ await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');

const testCaseRunner = new test_case_runner_1.default({
workerId: this.id,
eventBroadcaster: this.eventBroadcaster,

@@ -83,0 +80,0 @@ stopwatch,

@@ -12,2 +12,3 @@ /// <reference types="node" />

export interface INewTestCaseRunnerOptions {
workerId?: string;
eventBroadcaster: EventEmitter;

@@ -26,2 +27,3 @@ stopwatch: IStopwatch;

export default class TestCaseRunner {
private readonly workerId;
private readonly attachmentManager;

@@ -43,3 +45,3 @@ private currentTestCaseStartedId;

private readonly worldParameters;
constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters, }: INewTestCaseRunnerOptions);
constructor({ workerId, eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters, }: INewTestCaseRunnerOptions);
resetTestProgressData(): void;

@@ -46,0 +48,0 @@ getBeforeStepHookDefinitions(): TestStepHookDefinition[];

@@ -36,2 +36,3 @@ "use strict";

class TestCaseRunner {
workerId;
attachmentManager;

@@ -53,3 +54,4 @@ currentTestCaseStartedId;

worldParameters;
constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries = 0, skip, filterStackTraces, supportCodeLibrary, worldParameters, }) {
constructor({ workerId, eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries = 0, skip, filterStackTraces, supportCodeLibrary, worldParameters, }) {
this.workerId = workerId;
this.attachmentManager = new attachment_manager_1.default(({ data, media, fileName }) => {

@@ -172,2 +174,5 @@ if ((0, value_checker_1.doesNotHaveValue)(this.currentTestStepId)) {

};
if (this.workerId) {
testCaseStarted.testCaseStarted.workerId = this.workerId;
}
this.eventBroadcaster.emit('envelope', testCaseStarted);

@@ -174,0 +179,0 @@ // used to determine whether a hook is a Before or After

@@ -302,2 +302,3 @@ "use strict";

importPaths: [],
loaders: [],
}) {

@@ -304,0 +305,0 @@ this.cwd = cwd;

@@ -77,2 +77,3 @@ import * as messages from '@cucumber/messages';

importPaths: string[];
loaders: string[];
}

@@ -79,0 +80,0 @@ export interface SupportCodeLibrary {

@@ -1,1 +0,1 @@

export declare const version = "10.5.1";
export declare const version = "10.6.0";

@@ -5,3 +5,3 @@ "use strict";

// Generated by genversion.
exports.version = '10.5.1';
exports.version = '10.6.0';
//# sourceMappingURL=version.js.map

@@ -11,3 +11,3 @@ {

],
"version": "10.5.1",
"version": "10.6.0",
"funding": "https://opencollective.com/cucumber",

@@ -14,0 +14,0 @@ "homepage": "https://github.com/cucumber/cucumber-js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc