Skip to content

Commit

Permalink
Merge branch 'fix-spaces-dev-path-again' of github.com:cucumber/cucum…
Browse files Browse the repository at this point in the history
…ber-js into fix-spaces-dev-path-again
  • Loading branch information
eoola committed Dec 14, 2021
2 parents 65ba09d + c9974e7 commit ba71328
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ usage.txt
yarn-error.log
.vscode
.DS_Store
src/version.ts
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
## [Unreleased]
### Fixed
- Handles spaces in paths for developers working on cucumbers's own code ([#1845](https://github.com/cucumber/cucumber-js/issues/1845))
- Ensure package.json can be imported by consuming projects
([PR#1870](https://github.com/cucumber/cucumber-js/pull/1870)
[Issue#1869](https://github.com/cucumber/cucumber-js/issues/1869))
- Allows for parentheses in paths for developers working on cucumber's own code ([[#1735](https://github.com/cucumber/cucumber-js/issues/1735)])
- Smoother onboarding for Windows developers ([#1863](https://github.com/cucumber/cucumber-js/pull/1863))

### Added
- Export cucumber version number. It is now possible to retrieve the current version
of cucumber using `import { version } from '@cucumber/cucumber'`.
([PR#1866](https://github.com/cucumber/cucumber-js/pull/1866)
[Issue#1853](https://github.com/cucumber/cucumber-js/issues/1853))

## [8.0.0-rc.1] - 2021-10-19
### Added
- Add `wrapPromiseWithTimeout` to public API ([#1566](https://github.com/cucumber/cucumber-js/pull/1566))
Expand Down
24 changes: 23 additions & 1 deletion features/direct_imports.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,26 @@ Feature: Core feature elements execution using direct imports
Given(/^a step passes$/, function() {});
"""
When I run cucumber-js
Then it passes
Then it passes

Scenario: we can import the version number from package.json and from the library
Given a file named "features/a.feature" with:
"""
Feature: some feature
Scenario: some scenario
Given a step checks the version number
"""
And a file named "features/step_definitions/cucumber_steps.js" with:
"""
const {Given} = require('@cucumber/cucumber')
const package_version = require('@cucumber/cucumber/package.json').version
const library_version = require('@cucumber/cucumber').version
Given(/^a step checks the version number$/, function() {
if (package_version !== library_version) {
throw new Error(`package version: ${package_version} !== library version: ${library_version}`)
}
});
"""
When I run cucumber-js
Then it passes
3 changes: 1 addition & 2 deletions features/step_definitions/cli_steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
valueOrDefault,
} from '../../src/value_checker'
import { World } from '../support/world'

const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires
import { version } from '../../src/version'

When('my env includes {string}', function (this: World, envString: string) {
this.sharedEnv = this.parseEnvString(envString)
Expand Down
92 changes: 92 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
},
"./lib/*": {
"require": "./lib/*.js"
}
},
"./package.json": "./package.json"
},
"types": "./lib/index.d.ts",
"engines": {
Expand Down Expand Up @@ -251,6 +252,7 @@
"eslint-plugin-standard": "4.1.0",
"express": "4.17.1",
"fs-extra": "10.0.0",
"genversion": "^3.0.2",
"mocha": "9.1.3",
"mustache": "4.2.0",
"nyc": "15.1.0",
Expand All @@ -267,7 +269,7 @@
"typescript": "4.5.2"
},
"scripts": {
"build-local": "tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"feature-test": "node ./bin/cucumber-js",
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
Expand Down
4 changes: 1 addition & 3 deletions src/cli/argv_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { dialects } from '@cucumber/gherkin'
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'
import { getKeywords, getLanguages } from './i18n'
import Formatters from '../formatter/helpers/formatters'
import { version } from '../version'
import { PickleOrder } from './helpers'

// Using require instead of import so compiled typescript will have the desired folder structure
const { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires

export interface IParsedArgvFormatRerunOptions {
separator?: string
}
Expand Down
3 changes: 1 addition & 2 deletions src/cli/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ISupportCodeLibrary } from '../support_code_library_builder/types'
import TestCaseHookDefinition from '../models/test_case_hook_definition'
import TestRunHookDefinition from '../models/test_run_hook_definition'
import { builtinParameterTypes } from '../support_code_library_builder'
import { version } from '../version'

export interface IGetExpandedArgvRequest {
argv: string[]
Expand Down Expand Up @@ -117,8 +118,6 @@ export async function emitMetaMessage(
eventBroadcaster: EventEmitter,
env: NodeJS.ProcessEnv
): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../package.json')
eventBroadcaster.emit('envelope', {
meta: createMeta('cucumber-js', version, env),
})
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
} from './runtime'
export { default as supportCodeLibraryBuilder } from './support_code_library_builder'
export { default as DataTable } from './models/data_table'
export { version } from './version'

// Formatters
export { default as Formatter, IFormatterOptions } from './formatter'
Expand Down

0 comments on commit ba71328

Please sign in to comment.