Skip to content

Commit 92ba787

Browse files
authored
Merge branch 'main' into main
2 parents b2dfc43 + cf6ab33 commit 92ba787

File tree

12 files changed

+246
-230
lines changed

12 files changed

+246
-230
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525

2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v5
2828
- name: with Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
2929
uses: actions/setup-node@v4
3030
with:
@@ -34,7 +34,7 @@ jobs:
3434
coverage:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v5
3838
- uses: actions/setup-node@v4
3939
with:
4040
node-version: 22.x
@@ -47,7 +47,7 @@ jobs:
4747
audit-dependencies:
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
5151
- uses: actions/setup-node@v4
5252
with:
5353
node-version: 22.x

.github/workflows/release-github.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
permissions:
1313
contents: write
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- uses: cucumber/[email protected]
1717
with:
1818
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-npm-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
environment: Release
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- uses: actions/setup-node@v4
1717
with:
1818
node-version: '22'

.github/workflows/release-npm-next.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
environment: Release
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414
- uses: actions/setup-node@v4
1515
with:
1616
node-version: '22'

.github/workflows/site.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
upload-artifact:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
- uses: actions/setup-node@v4
1414
with:
1515
node-version: 22.6

compatibility/cck_spec.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
3-
import { PassThrough, pipeline, Writable } from 'node:stream'
4-
import util from 'node:util'
3+
import { PassThrough, Writable } from 'node:stream'
4+
import { pipeline } from 'node:stream/promises'
55
import { describe, it } from 'mocha'
66
import { config, expect, use } from 'chai'
77
import chaiExclude from 'chai-exclude'
@@ -12,7 +12,6 @@ import { Envelope } from '@cucumber/messages'
1212
import { ignorableKeys } from '../features/support/formatter_output_helpers'
1313
import { runCucumber, IRunConfiguration } from '../src/api'
1414

15-
const asyncPipeline = util.promisify(pipeline)
1615
const PROJECT_PATH = path.join(__dirname, '..')
1716
const CCK_FEATURES_PATH = 'node_modules/@cucumber/compatibility-kit/features'
1817
const CCK_IMPLEMENTATIONS_PATH = 'compatibility/features'
@@ -21,36 +20,37 @@ config.truncateThreshold = 100
2120
use(chaiExclude)
2221

2322
describe('Cucumber Compatibility Kit', () => {
24-
const ndjsonFiles = glob.sync(`${CCK_FEATURES_PATH}/**/*.ndjson`)
25-
ndjsonFiles.forEach((fixturePath) => {
26-
const match = /^.+[/\\](.+)(\.feature(?:\.md)?)\.ndjson$/.exec(fixturePath)
27-
const suiteName = match[1]
28-
const extension = match[2]
29-
it(`passes the cck suite for '${suiteName}'`, async () => {
23+
const directories = glob.sync(`${CCK_FEATURES_PATH}/*`, { nodir: false })
24+
25+
for (const directory of directories) {
26+
const suite = path.basename(directory)
27+
28+
it(suite, async () => {
3029
const actualMessages: Envelope[] = []
3130
const stdout = new PassThrough()
3231
const stderr = new PassThrough()
3332
const runConfiguration: IRunConfiguration = {
3433
sources: {
3534
defaultDialect: 'en',
36-
paths: [`${CCK_FEATURES_PATH}/${suiteName}/${suiteName}${extension}`],
35+
paths: [
36+
`${CCK_FEATURES_PATH}/${suite}/*.feature`,
37+
`${CCK_FEATURES_PATH}/${suite}/*.feature.md`,
38+
],
3739
names: [],
3840
tagExpression: '',
3941
order: 'defined',
4042
shard: '',
4143
},
4244
support: {
4345
requireModules: ['ts-node/register'],
44-
requirePaths: [
45-
`${CCK_IMPLEMENTATIONS_PATH}/${suiteName}/${suiteName}.ts`,
46-
],
46+
requirePaths: [`${CCK_IMPLEMENTATIONS_PATH}/${suite}/*.ts`],
4747
},
4848
runtime: {
4949
dryRun: false,
5050
failFast: false,
5151
filterStacktraces: true,
5252
parallel: 0,
53-
retry: suiteName === 'retry' ? 2 : 0,
53+
retry: suite === 'retry' ? 2 : 0,
5454
retryTagFilter: '',
5555
strict: true,
5656
worldParameters: {},
@@ -75,8 +75,10 @@ describe('Cucumber Compatibility Kit', () => {
7575
stderr.end()
7676

7777
const expectedMessages: messages.Envelope[] = []
78-
await asyncPipeline(
79-
fs.createReadStream(fixturePath, { encoding: 'utf-8' }),
78+
await pipeline(
79+
fs.createReadStream(path.join(directory, suite + '.ndjson'), {
80+
encoding: 'utf-8',
81+
}),
8082
new messageStreams.NdjsonToMessageStream(),
8183
new Writable({
8284
objectMode: true,
@@ -91,5 +93,5 @@ describe('Cucumber Compatibility Kit', () => {
9193
.excludingEvery(ignorableKeys)
9294
.to.deep.eq(expectedMessages)
9395
})
94-
})
96+
}
9597
})

compatibility/features/attachments/attachments.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,6 @@ When(
3535
}
3636
)
3737

38-
When('a JPEG image is attached', async function () {
39-
await this.attach(
40-
fs.createReadStream(
41-
path.join(
42-
process.cwd(),
43-
'node_modules',
44-
'@cucumber',
45-
'compatibility-kit',
46-
'features',
47-
'attachments',
48-
'cucumber.jpeg'
49-
)
50-
),
51-
'image/jpeg'
52-
)
53-
})
54-
55-
When('a PNG image is attached', async function () {
56-
await this.attach(
57-
fs.createReadStream(
58-
path.join(
59-
process.cwd(),
60-
'node_modules',
61-
'@cucumber',
62-
'compatibility-kit',
63-
'features',
64-
'attachments',
65-
'cucumber.png'
66-
)
67-
),
68-
'image/png'
69-
)
70-
})
71-
7238
When('a PDF document is attached and renamed', async function () {
7339
await this.attach(
7440
fs.createReadStream(

docs/profiles.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The short tag is `-p`
1414
cucumber-js -p my_profile
1515
```
1616

17-
## Simple Example
17+
## Simple example
1818

1919
Let's take the common case of having some things a bit different locally than on a continuous integration server. Here's the configuration we've been running locally:
2020

@@ -67,6 +67,31 @@ Now, if we just run `cucumber-js` with no arguments, it will pick up our profile
6767
cucumber-js -p ci
6868
```
6969

70+
## ESM example
71+
72+
When using ES modules, you should use a default export for your default profile and named exports for additional profiles:
73+
74+
```javascript
75+
const common = {
76+
requireModule: ['ts-node/register'],
77+
require: ['support/**/*.ts'],
78+
worldParameters: {
79+
appUrl: process.env.MY_APP_URL || 'http://localhost:3000/'
80+
}
81+
}
82+
83+
export default {
84+
...common,
85+
format: ['progress-bar', 'html:cucumber-report.html'],
86+
}
87+
88+
export const ci = {
89+
...common,
90+
format: ['html:cucumber-report.html'],
91+
publish: true
92+
}
93+
```
94+
7095
## Defining profiles dynamically
7196

7297
If you need to define your profiles dynamically (including asynchronously), you can use the `default` profile key/export to provide an async function that resolves to your profiles. This can be particularly useful in an ESM context where the profiles are static exports. Here's an example:

features/support/hooks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ Before('@esm', function (this: World) {
5353
})
5454

5555
Before('@without-require-esm', function (this: World) {
56-
// @ts-expect-error require_module flag not in @types/node yet
5756
if (process.features.require_module) {
5857
return 'skipped'
5958
}

0 commit comments

Comments
 (0)