Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export version number of cucumber-js #1866

Merged
merged 4 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ -266,7 +267,7 @@
"typescript": "4.5.2"
},
"scripts": {
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && cp src/importer.js lib/ && 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 @@ -3,9 +3,7 @@ import path from 'path'
import { dialects } from '@cucumber/gherkin'
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'
import Formatters from '../formatter/helpers/formatters'

// 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
import { version } from '../version'

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 @@ -114,8 +115,6 @@ export function isJavaScript(filePath: string): boolean {
export async function emitMetaMessage(
eventBroadcaster: EventEmitter
): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../package.json')
eventBroadcaster.emit('envelope', {
meta: createMeta('cucumber-js', version, process.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