Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into renovate/major-cucumb…
Browse files Browse the repository at this point in the history
…er-packages
  • Loading branch information
aurelien-reeves committed Oct 1, 2021
2 parents fc3183a + 04b320a commit 6ecd532
Show file tree
Hide file tree
Showing 15 changed files with 327 additions and 462 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ See the [migration guide](./docs/migration.md) for details of how to migrate fro
* Drop support for Node.js 10 and 15, add support for Node.js 16
* Remove deprecated `--retryTagFilter` option (the correct option is `--retry-tag-filter`)
* Remove `setDefinitionFunctionWrapper` and step definition option `wrapperOptions`
* Remove `--predictable-ids` option (was only used for internal testing)

### Added

Expand Down
28 changes: 5 additions & 23 deletions compatibility/cck_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import path from 'path'
import { PassThrough, pipeline, Writable } from 'stream'
import { Cli } from '../src'
import toString from 'stream-to-string'
import { normalizeMessageOutput } from '../features/support/formatter_output_helpers'
import {
ignorableKeys,
normalizeMessageOutput,
} from '../features/support/formatter_output_helpers'
import * as messages from '@cucumber/messages'
import * as messageStreams from '@cucumber/message-streams'
import util from 'util'
Expand Down Expand Up @@ -74,28 +77,7 @@ describe('Cucumber Compatibility Kit', () => {
)

expect(actualMessages)
.excludingEvery([
'meta',
// sources
'uri',
'line',
// ids
'astNodeId',
'astNodeIds',
'hookId',
'id',
'pickleId',
'pickleStepId',
'stepDefinitionIds',
'testCaseId',
'testCaseStartedId',
'testStepId',
// time
'nanos',
'seconds',
// errors
'message',
])
.excludingEvery(ignorableKeys)
.to.deep.eq(expectedMessages)
})
})
Expand Down
8 changes: 6 additions & 2 deletions features/step_definitions/formatter_steps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Then } from '../../'
import { expect } from 'chai'
import { expect, use } from 'chai'
import chaiExclude from 'chai-exclude'
import {
ignorableKeys,
normalizeJsonOutput,
normalizeMessageOutput,
stripMetaMessages,
Expand All @@ -9,6 +11,8 @@ import fs from 'mz/fs'
import path from 'path'
import { World } from '../support/world'

use(chaiExclude)

Then(
'the message formatter output matches the fixture {string}',
async function (this: World, filePath: string) {
Expand All @@ -18,7 +22,7 @@ Then(
const fixturePath = path.join(__dirname, '..', 'fixtures', filePath)
const expected = require(fixturePath) // eslint-disable-line @typescript-eslint/no-var-requires
try {
expect(actual).to.eql(expected)
expect(actual).excludingEvery(ignorableKeys).to.deep.eq(expected)
} catch (e) {
if (process.env.GOLDEN) {
await fs.writeFile(
Expand Down
23 changes: 23 additions & 0 deletions features/support/formatter_output_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,26 @@ export function normalizeJsonOutput(str: string, cwd: string): IJsonFeature[] {
})
return json
}

export const ignorableKeys = [
'meta',
// sources
'uri',
'line',
// ids
'astNodeId',
'astNodeIds',
'hookId',
'id',
'pickleId',
'pickleStepId',
'stepDefinitionIds',
'testCaseId',
'testCaseStartedId',
'testStepId',
// time
'nanos',
'seconds',
// errors
'message',
]
1 change: 0 additions & 1 deletion features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class World {
const messageFilename = 'message.ndjson'
const args = ['node', executablePath].concat(inputArgs, [
'--backtrace',
'--predictable-ids',
'--format',
`message:${messageFilename}`,
])
Expand Down
Loading

0 comments on commit 6ecd532

Please sign in to comment.