Skip to content

Commit

Permalink
Export version number of cucumber-js (#1866)
Browse files Browse the repository at this point in the history
* Export version number of cucumber-js

* Update CHANGELOG.md
  • Loading branch information
aurelien-reeves committed Dec 13, 2021
1 parent efff3a3 commit 42d95b6
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 8 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
- 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
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.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,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 +268,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 42d95b6

Please sign in to comment.