@cucumber/cucumber
Advanced tools
Comparing version 8.4.0 to 8.5.0
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { IFormatterStream } from '../formatter'; | ||
@@ -3,0 +5,0 @@ import { EventEmitter } from 'events'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { IRuntime } from '../runtime'; | ||
@@ -3,0 +4,0 @@ import { EventEmitter } from 'events'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
@@ -3,0 +6,0 @@ import PickleFilter from '../pickle_filter'; |
@@ -16,3 +16,3 @@ "use strict"; | ||
async run() { | ||
await (0, install_validator_1.validateInstall)(this.cwd); | ||
await (0, install_validator_1.validateInstall)(); | ||
const { options, configuration: argvConfiguration } = configuration_1.ArgvParser.parse(this.argv); | ||
@@ -19,0 +19,0 @@ if (options.i18nLanguages) { |
@@ -1,1 +0,1 @@ | ||
export declare function validateInstall(cwd: string): Promise<void>; | ||
export declare function validateInstall(): Promise<void>; |
@@ -7,35 +7,13 @@ "use strict"; | ||
exports.validateInstall = void 0; | ||
const fs_1 = __importDefault(require("mz/fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const resolve_1 = __importDefault(require("resolve")); | ||
const util_1 = require("util"); | ||
async function validateInstall(cwd) { | ||
const projectPath = path_1.default.join(__dirname, '..', '..'); | ||
if (projectPath === cwd) { | ||
return; // cucumber testing itself | ||
} | ||
const currentCucumberPath = require.resolve(projectPath); | ||
let localCucumberPath; | ||
try { | ||
localCucumberPath = await (0, util_1.promisify)(resolve_1.default)('@cucumber/cucumber', { | ||
basedir: cwd, | ||
}); | ||
} | ||
catch (e) { | ||
throw new Error('`@cucumber/cucumber` module not resolvable. Must be locally installed.'); | ||
} | ||
localCucumberPath = await fs_1.default.realpath(localCucumberPath); | ||
if (localCucumberPath !== currentCucumberPath) { | ||
throw new Error(` | ||
You appear to be executing an install of cucumber (most likely a global install) | ||
that is different from your local install (the one required in your support files). | ||
For cucumber to work, you need to execute the same install that is required in your support files. | ||
Please execute the locally installed version to run your tests. | ||
Executed Path: ${currentCucumberPath} | ||
Local Path: ${localCucumberPath} | ||
/* eslint-disable no-console */ | ||
const is_installed_globally_1 = __importDefault(require("is-installed-globally")); | ||
async function validateInstall() { | ||
if (is_installed_globally_1.default) | ||
console.warn(` | ||
It looks like you're running Cucumber from a global installation. | ||
This won't work - you need to have Cucumber installed as a local dependency in your project. | ||
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations | ||
`); | ||
} | ||
} | ||
exports.validateInstall = validateInstall; | ||
//# sourceMappingURL=install_validator.js.map |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import StepDefinitionSnippetBuilder from './step_definition_snippet_builder'; | ||
@@ -3,0 +6,0 @@ import { ISupportCodeLibrary } from '../support_code_library_builder/types'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { TestStepResultStatus } from '@cucumber/messages'; | ||
@@ -3,0 +4,0 @@ import { Writable } from 'stream'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Transform } from 'stream'; | ||
@@ -3,0 +5,0 @@ import http from 'http'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { IColorFns } from './get_color_fns'; | ||
@@ -3,0 +6,0 @@ import { EventDataCollector } from './helpers'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Readable } from 'stream'; | ||
@@ -3,0 +4,0 @@ import * as messages from '@cucumber/messages'; |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { ChildProcess } from 'child_process'; | ||
@@ -3,0 +5,0 @@ import * as messages from '@cucumber/messages'; |
@@ -59,3 +59,3 @@ "use strict"; | ||
if (message.ready) { | ||
worker.state = 0 /* idle */; | ||
worker.state = 0 /* WorkerState.idle */; | ||
this.awakenWorkers(worker); | ||
@@ -77,6 +77,6 @@ } | ||
Object.values(this.workers).forEach((worker) => { | ||
if (worker.state === 0 /* idle */) { | ||
if (worker.state === 0 /* WorkerState.idle */) { | ||
this.giveWork(worker); | ||
} | ||
return worker.state !== 0 /* idle */; | ||
return worker.state !== 0 /* WorkerState.idle */; | ||
}); | ||
@@ -100,3 +100,3 @@ if (Object.keys(this.inProgressPickles).length == 0 && | ||
}); | ||
const worker = { state: 3 /* new */, process: workerProcess, id }; | ||
const worker = { state: 3 /* WorkerState.new */, process: workerProcess, id }; | ||
this.workers[id] = worker; | ||
@@ -107,3 +107,3 @@ worker.process.on('message', (message) => { | ||
worker.process.on('close', (exitCode) => { | ||
worker.state = 1 /* closed */; | ||
worker.state = 1 /* WorkerState.closed */; | ||
this.onWorkerProcessClose(exitCode); | ||
@@ -132,3 +132,3 @@ }); | ||
} | ||
if (Object.values(this.workers).every((x) => x.state === 1 /* closed */)) { | ||
if (Object.values(this.workers).every((x) => x.state === 1 /* WorkerState.closed */)) { | ||
const envelope = { | ||
@@ -195,3 +195,3 @@ testRunFinished: { | ||
const finalizeCommand = { finalize: true }; | ||
worker.state = 2 /* running */; | ||
worker.state = 2 /* WorkerState.running */; | ||
worker.process.send(finalizeCommand); | ||
@@ -223,3 +223,3 @@ return; | ||
}; | ||
worker.state = 2 /* running */; | ||
worker.state = 2 /* WorkerState.running */; | ||
worker.process.send(runCommand); | ||
@@ -226,0 +226,0 @@ } |
@@ -35,3 +35,3 @@ "use strict"; | ||
constructor() { | ||
this.methods = { | ||
const methods = { | ||
After: this.defineTestCaseHook(() => this.afterTestCaseHookDefinitionConfigs), | ||
@@ -61,2 +61,23 @@ AfterAll: this.defineTestRunHook(() => this.afterTestRunHookDefinitionConfigs), | ||
}; | ||
const checkInstall = (method) => { | ||
if ((0, value_checker_1.doesNotHaveValue)(this.cwd)) { | ||
throw new Error(` | ||
You're calling functions (e.g. "${method}") on an instance of Cucumber that isn't running. | ||
This means you have an invalid installation, mostly likely due to: | ||
- Cucumber being installed globally | ||
- A project structure where your support code is depending on a different instance of Cucumber | ||
Either way, you'll need to address this in order for Cucumber to work. | ||
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations | ||
`); | ||
} | ||
}; | ||
this.methods = new Proxy(methods, { | ||
get(target, method) { | ||
return (...args) => { | ||
checkInstall(method); | ||
// @ts-expect-error difficult to type this correctly | ||
return target[method](...args); | ||
}; | ||
}, | ||
}); | ||
} | ||
@@ -63,0 +84,0 @@ defineParameterType(options) { |
@@ -1,1 +0,1 @@ | ||
export declare const version = "8.4.0"; | ||
export declare const version = "8.5.0"; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = '8.4.0'; | ||
exports.version = '8.5.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "8.4.0", | ||
"version": "8.5.0", | ||
"homepage": "https://github.com/cucumber/cucumber-js", | ||
@@ -200,3 +200,3 @@ "author": "Julien Biezemans <jb@jbpros.com>", | ||
"@cucumber/ci-environment": "9.0.4", | ||
"@cucumber/cucumber-expressions": "15.2.0", | ||
"@cucumber/cucumber-expressions": "16.0.0", | ||
"@cucumber/gherkin": "24.0.0", | ||
@@ -207,3 +207,3 @@ "@cucumber/gherkin-streams": "5.0.1", | ||
"@cucumber/message-streams": "4.0.1", | ||
"@cucumber/messages": "19.0.0", | ||
"@cucumber/messages": "19.1.2", | ||
"@cucumber/tag-expressions": "4.1.0", | ||
@@ -221,2 +221,3 @@ "assertion-error-formatter": "^3.0.0", | ||
"indent-string": "^4.0.0", | ||
"is-installed-globally": "^0.4.0", | ||
"is-stream": "^2.0.0", | ||
@@ -228,3 +229,2 @@ "knuth-shuffle-seeded": "^1.0.6", | ||
"progress": "^2.0.3", | ||
"resolve": "^1.19.0", | ||
"resolve-pkg": "^2.0.0", | ||
@@ -242,6 +242,6 @@ "semver": "7.3.7", | ||
"devDependencies": { | ||
"@cucumber/compatibility-kit": "10.0.0", | ||
"@cucumber/compatibility-kit": "11.0.1", | ||
"@cucumber/query": "12.0.0", | ||
"@microsoft/api-documenter": "7.17.11", | ||
"@microsoft/api-extractor": "7.23.0", | ||
"@microsoft/api-documenter": "7.18.0", | ||
"@microsoft/api-extractor": "7.28.2", | ||
"@sinonjs/fake-timers": "9.1.2", | ||
@@ -253,3 +253,3 @@ "@types/chai": "4.3.1", | ||
"@types/glob": "7.2.0", | ||
"@types/has-ansi": "^5.0.0", | ||
"@types/has-ansi": "5.0.0", | ||
"@types/lodash.merge": "4.6.7", | ||
@@ -260,6 +260,5 @@ "@types/lodash.mergewith": "4.6.7", | ||
"@types/mz": "2.7.4", | ||
"@types/node": "16.11.38", | ||
"@types/node": "16.11.42", | ||
"@types/progress": "2.0.5", | ||
"@types/resolve": "1.20.2", | ||
"@types/semver": "7.3.9", | ||
"@types/semver": "7.3.10", | ||
"@types/sinon-chai": "3.2.8", | ||
@@ -270,4 +269,4 @@ "@types/sinonjs__fake-timers": "8.1.2", | ||
"@types/verror": "1.10.5", | ||
"@typescript-eslint/eslint-plugin": "5.27.0", | ||
"@typescript-eslint/parser": "5.27.0", | ||
"@typescript-eslint/eslint-plugin": "5.30.3", | ||
"@typescript-eslint/parser": "5.30.3", | ||
"chai": "4.3.6", | ||
@@ -278,7 +277,7 @@ "chai-exclude": "2.1.0", | ||
"dirty-chai": "2.0.1", | ||
"eslint": "8.16.0", | ||
"eslint": "8.18.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-standard": "4.1.0", | ||
@@ -291,3 +290,3 @@ "express": "4.18.1", | ||
"nyc": "15.1.0", | ||
"prettier": "2.6.2", | ||
"prettier": "2.7.1", | ||
"reindent-template-literals": "1.1.0", | ||
@@ -299,5 +298,5 @@ "shx": "0.3.4", | ||
"stream-to-string": "1.2.0", | ||
"ts-node": "10.8.0", | ||
"tsd": "0.20.0", | ||
"typescript": "4.7.2" | ||
"ts-node": "10.8.1", | ||
"tsd": "0.22.0", | ||
"typescript": "4.7.4" | ||
}, | ||
@@ -304,0 +303,0 @@ "scripts": { |
@@ -90,2 +90,3 @@ <h1 align="center"> | ||
* [Installation](./docs/installation.md) | ||
* [CLI](./docs/cli.md) | ||
@@ -92,0 +93,0 @@ * [Configuration](./docs/configuration.md) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
747362
53
7569
118
12
+ Addedis-installed-globally@^0.4.0
+ Added@cucumber/cucumber-expressions@16.0.0(transitive)
+ Added@cucumber/messages@19.1.2(transitive)
+ Addedglobal-dirs@3.0.1(transitive)
+ Addedini@2.0.0(transitive)
+ Addedis-installed-globally@0.4.0(transitive)
+ Addedis-path-inside@3.0.3(transitive)
- Removedresolve@^1.19.0
- Removed@cucumber/cucumber-expressions@15.2.0(transitive)
- Removed@cucumber/messages@19.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
Updated@cucumber/messages@19.1.2