Skip to content

Commit

Permalink
Use .feature.md extension. Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed May 24, 2021
1 parent 9c0c509 commit 3caecf5
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO

### Added

* Experimental support for [Markdown](https://github.com/cucumber/common/blob/main/gherkin/MARKDOWN_WITH_GHERKIN.md)
([#1645](https://github.com/cucumber/cucumber-js/pull/1645))

### Changed

* Clarify that the JSON formatter will not be removed any time soon
Expand Down
2 changes: 1 addition & 1 deletion compatibility/cck_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use(chaiExclude)

describe('Cucumber Compatibility Kit', () => {
glob.sync(`${CCK_FEATURES_PATH}/**/*.ndjson`).forEach((fixturePath) => {
const match = /^.+\/(.+)(\.md|\.feature)\.ndjson$/.exec(fixturePath)
const match = /^.+\/(.+)(\.feature(?:\.md)?)\.ndjson$/.exec(fixturePath)
const suiteName = match[1]
const extension = match[2]
it(`passes the cck suite for '${suiteName}'`, async () => {
Expand Down
25 changes: 22 additions & 3 deletions compatibility/features/markdown/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import assert from 'assert'
import { Given } from '../../../src'
import { Given, DataTable, Then, When, World } from '../../../src'

Given('I have {int} cukes in my belly', function (cukeCount: number) {
assert(cukeCount)
Given('some TypeScript code:', function (dataTable: DataTable) {
assert(dataTable)
})

Given('some classic Gherkin:', function (gherkin: string) {
assert(gherkin)
})

When(
'we use a data table and attach something and then {word}',
async function (this: World, word: string, dataTable: DataTable) {
await this.log('We are logging some plain text')
assert(dataTable)
if (word === 'fail') {
throw new Error('You asked me to fail')
}
}
)

Then('this might or might not run', function () {
// no-op
})
19 changes: 19 additions & 0 deletions features/cli.md → features/cli.feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ I want to run Cucumber on the command line
When(/^a step is passing$/, function() {})
```
* When I run cucumber-js with `-r step_definitions/cucumber_steps.js`
* Then it passes

## Scenario: run Markdown feature with non-default step definitions file location specified (-r option)

* Given a file named "features/a.feature.md" with:
```markdown
# Feature: some feature
## Scenario:
* When a step is passing
```
* And a file named "step_definitions/cucumber_steps.js" with:
```javascript
const {When} = require('@cucumber/cucumber')

When(/^a step is passing$/, function() {})
```
* When I run cucumber-js with `-r step_definitions/cucumber_steps.js`
* Then it passes

## Scenario: run feature with step definitions in required directory (-r option)

Expand All @@ -34,6 +52,7 @@ I want to run Cucumber on the command line
When(/^a step is passing$/, function() {});
```
* When I run cucumber-js with `-r step_definitions`
* Then it passes

`@spawn`
# Scenario: display Cucumber version
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@
"dependencies": {
"@cucumber/create-meta": "^5.0.0",
"@cucumber/cucumber-expressions": "^12.1.1",
"@cucumber/gherkin": "^19.0.2",
"@cucumber/gherkin": "^19.0.3",
"@cucumber/gherkin-streams": "^2.0.2",
"@cucumber/html-formatter": "^14.0.0",
"@cucumber/messages": "^16.0.0",
"@cucumber/messages": "^16.0.1",
"@cucumber/tag-expressions": "^3.0.1",
"assertion-error-formatter": "^3.0.0",
"bluebird": "^3.7.2",
Expand Down Expand Up @@ -203,7 +203,7 @@
"verror": "^1.10.0"
},
"devDependencies": {
"@cucumber/compatibility-kit": "5.0.1",
"@cucumber/compatibility-kit": "6.0.0",
"@cucumber/message-streams": "2.0.0",
"@cucumber/query": "10.0.0",
"@sinonjs/fake-timers": "7.0.5",
Expand Down
4 changes: 2 additions & 2 deletions src/cli/configuration_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default class ConfigurationBuilder {

async expandFeaturePaths(featurePaths: string[]): Promise<string[]> {
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')) // Strip line numbers
return this.expandPaths(featurePaths, '.md')
return this.expandPaths(featurePaths, '.feature')
}

getFeatureDirectoryPaths(featurePaths: string[]): string[] {
Expand Down Expand Up @@ -219,6 +219,6 @@ export default class ConfigurationBuilder {
return featurePaths
}
}
return ['features/**/*.{feature,md}']
return ['features/**/*.{feature,feature.md}']
}
}
10 changes: 7 additions & 3 deletions src/cli/configuration_builder_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Configuration', () => {
parallel: 0,
pickleFilterOptions: {
cwd,
featurePaths: ['features/**/*.{feature,md}'],
featurePaths: ['features/**/*.{feature,feature.md}'],
names: [],
tagExpression: '',
},
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Configuration', () => {
it('returns the appropriate .md and support code paths', async function () {
// Arrange
const cwd = await buildTestWorkingDirectory()
const relativeFeaturePath = path.join('features', 'a.md')
const relativeFeaturePath = path.join('features', 'a.feature.md')
const featurePath = path.join(cwd, relativeFeaturePath)
await fsExtra.outputFile(featurePath, '')
const supportCodePath = path.join(cwd, 'features', 'a.js')
Expand Down Expand Up @@ -139,7 +139,11 @@ describe('Configuration', () => {
it('returns the appropriate .md and support code paths', async function () {
// Arrange
const cwd = await buildTestWorkingDirectory()
const relativeFeaturePath = path.join('features', 'nested', 'a.md')
const relativeFeaturePath = path.join(
'features',
'nested',
'a.feature.md'
)
const featurePath = path.join(cwd, relativeFeaturePath)
await fsExtra.outputFile(featurePath, '')
const supportCodePath = path.join(cwd, 'features', 'a.js')
Expand Down
71 changes: 39 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@
"@babel/helper-validator-identifier" "^7.14.0"
to-fast-properties "^2.0.0"

"@cucumber/compatibility-kit@5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@cucumber/compatibility-kit/-/compatibility-kit-5.0.1.tgz#cf19e3d8305fb31ebaa1664e68f5685a374eda8e"
integrity sha512-B5Ug+GuvKaV6Em5SsjNv12r61SYmL3yDXDX8vU9+oITVlxsuKJnDUOZwU1MNK+1c9AQM7n+cMKHfuNM4t5CopA==
"@cucumber/compatibility-kit@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@cucumber/compatibility-kit/-/compatibility-kit-6.0.0.tgz#c36aa033df6638450e84930015a7d5204eff9897"
integrity sha512-WkjgmbgKxjIk3hhfuvbqFvW1zLjX4DoCc+Ivjxg44Nrs2zj7FIvWP2R2isGtdAMQy2FUy//vfJlt0y61Pw2EtQ==

"@cucumber/create-meta@^5.0.0":
version "5.0.0"
Expand All @@ -238,13 +238,13 @@
commander "7.2.0"
source-map-support "0.5.19"

"@cucumber/gherkin@^19.0.1", "@cucumber/gherkin@^19.0.2":
version "19.0.2"
resolved "https://registry.yarnpkg.com/@cucumber/gherkin/-/gherkin-19.0.2.tgz#bb09b3239c76d1e23e40451a93e6f496706ea4fb"
integrity sha512-ylhFABT04p5PIkc8bi1VBYnAaLvvoO5nGxHX9Zm8fZ3oHVTi52fE/zkDTdOZyO0uP2fjJmBP6cueL1rrYAzUfA==
"@cucumber/gherkin@^19.0.1", "@cucumber/gherkin@^19.0.3":
version "19.0.3"
resolved "https://registry.yarnpkg.com/@cucumber/gherkin/-/gherkin-19.0.3.tgz#61036ca4940e66f8a787be5f92ce229ae3815ebf"
integrity sha512-gWdMm8mfRk3P+VugJWvNALaQV5QnT+5RkqWy3tO+4NsMSQZPo5p4V4vXwriQZ/sZR1Wni5TDRztuRsKLgZ3XHA==
dependencies:
"@cucumber/message-streams" "^2.0.0"
"@cucumber/messages" "^16.0.0"
"@cucumber/messages" "^16.0.1"

"@cucumber/html-formatter@^14.0.0":
version "14.0.0"
Expand All @@ -262,10 +262,10 @@
dependencies:
"@cucumber/messages" "^16.0.0"

"@cucumber/messages@^16.0.0":
version "16.0.0"
resolved "https://registry.yarnpkg.com/@cucumber/messages/-/messages-16.0.0.tgz#41c57380362b41fd507e2a3bd2a65e82021a2a8f"
integrity sha512-sGYLfsR1uOZsDIjMJr89SUEvLJJgJ3uMr/9NzPBKbrL5pgoyz7xWRUj9sgk1U4+qXSflJC2C9QVTdrRedlk+Lw==
"@cucumber/messages@^16.0.0", "@cucumber/messages@^16.0.1":
version "16.0.1"
resolved "https://registry.yarnpkg.com/@cucumber/messages/-/messages-16.0.1.tgz#8a9f9bb6ad0430d8ddd044dd49cb45ef37ee67b7"
integrity sha512-80JcaAfQragFqR1rMhRwiqWL9HcR6Z4LDD2mfF0Lxg/lFkCNvmWa9Jl10NUNfFXYD555NKPzP/8xFo55abw8TQ==
dependencies:
"@types/uuid" "8.3.0"
class-transformer "0.4.0"
Expand Down Expand Up @@ -349,7 +349,7 @@
dependencies:
type-detect "4.0.8"

"@sinonjs/[email protected]", "@sinonjs/fake-timers@^7.0.4":
"@sinonjs/[email protected]":
version "7.0.5"
resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-7.0.5.tgz#558a7f8145a01366c44b3dcbdd7172c05c461564"
integrity sha512-fUt6b15bjV/VW93UP5opNXJxdwZSbK1EdiwnhN7XrQrcpaOhMJpZ/CjwFpM3THpxwA+YviBUJKSuEqKlCK5alw==
Expand All @@ -363,6 +363,13 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/fake-timers@^7.0.4":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-7.1.0.tgz#8f13af27d842cbf51ad4502e05562fe9391d084e"
integrity sha512-hAEzXi6Wbvlb67NnGMGSNOeAflLVnMa4yliPU/ty1qjgW/vAletH15/v/esJwASSIA0YlIyjnloenFbEZc9q9A==
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/samsam@^5.3.1":
version "5.3.1"
resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-5.3.1.tgz#375a45fe6ed4e92fca2fb920e007c48232a6507f"
Expand Down Expand Up @@ -516,9 +523,9 @@
"@types/node" "*"

"@types/node@*":
version "15.3.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.3.0.tgz#d6fed7d6bc6854306da3dea1af9f874b00783e26"
integrity sha512-8/bnjSZD86ZfpBsDlCIkNXIvm+h6wi9g7IqL+kmFkQ+Wvu3JrasgLElfiPgoo8V8vVfnEi0QVS12gbl94h9YsQ==
version "15.6.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.0.tgz#f0ddca5a61e52627c9dcb771a6039d44694597bc"
integrity sha512-gCYSfQpy+LYhOFTKAeE8BkyGqaxmlFxe+n4DKM6DR0wzw/HISUE/hAmkC/KT8Sw5PCJblqg062b3z9gucv3k0A==

"@types/[email protected]":
version "14.14.43"
Expand Down Expand Up @@ -777,9 +784,9 @@ ajv@^6.10.0, ajv@^6.12.4:
uri-js "^4.2.2"

ajv@^8.0.1:
version "8.4.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.4.0.tgz#48984fdb2ce225cab15795f0772a8d85669075e4"
integrity sha512-7QD2l6+KBSLwf+7MuYocbWvRPdOu63/trReTLu2KFwkgctnub1auoF+Y1WYcm09CTM7quuscrzqmASaLHC/K4Q==
version "8.5.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.5.0.tgz#695528274bcb5afc865446aa275484049a18ae4b"
integrity sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
Expand Down Expand Up @@ -1576,9 +1583,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.3.723:
version "1.3.732"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.732.tgz#2a07a8d61f74f2084b6f6bf2a908605a7a0b2d8d"
integrity sha512-qKD5Pbq+QMk4nea4lMuncUMhpEiQwaJyCW7MrvissnRcBDENhVfDmAqQYRQ3X525oTzhar9Zh1cK0L2d1UKYcw==
version "1.3.736"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.736.tgz#f632d900a1f788dab22fec9c62ec5c9c8f0c4052"
integrity sha512-DY8dA7gR51MSo66DqitEQoUMQ0Z+A2DSXFi7tK304bdTVqczCAfUuyQw6Wdg8hIoo5zIxkU1L24RQtUce1Ioig==

emoji-regex@^7.0.1:
version "7.0.3"
Expand Down Expand Up @@ -3206,9 +3213,9 @@ normalize-path@^3.0.0, normalize-path@~3.0.0:
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==

normalize-url@^4.1.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
version "4.5.1"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a"
integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==

[email protected]:
version "15.1.0"
Expand Down Expand Up @@ -3479,9 +3486,9 @@ pathval@^1.1.1:
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==

picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.3.tgz#465547f359ccc206d3c48e46a1bcb89bf7ee619d"
integrity sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==
version "2.3.0"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==

pify@^2.0.0:
version "2.3.0"
Expand Down Expand Up @@ -3981,9 +3988,9 @@ spdx-expression-parse@^3.0.0:
spdx-license-ids "^3.0.0"

spdx-license-ids@^3.0.0:
version "3.0.8"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.8.tgz#eb1e97ad99b11bf3f82a3b71a0472dd9a00f2ecf"
integrity sha512-NDgA96EnaLSvtbM7trJj+t1LUR3pirkDCcz9nOUlPb5DMBGsH7oES6C3hs3j7R9oHEa1EMvReS/BUAIT5Tcr0g==
version "3.0.9"
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz#8a595135def9592bda69709474f1cbeea7c2467f"
integrity sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==

sprintf-js@~1.0.2:
version "1.0.3"
Expand Down

0 comments on commit 3caecf5

Please sign in to comment.