Skip to content

Commit

Permalink
Remove synthetic step for empty pickles (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Aug 29, 2024
1 parent 8f0f43b commit efa0754
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 30 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Removed
- BREAKING CHANGE: Remove synthetic step for empty pickles ([#125](https://github.com/cucumber/fake-cucumber/pull/125))

## [16.5.0] - 2024-08-01
### Added
Expand Down
2 changes: 2 additions & 0 deletions features/empty.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Feature: Empty feature
Scenario: Empty scenario
11 changes: 0 additions & 11 deletions src/EmptyPickleTestStep.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/makeTestCase.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Query } from '@cucumber/gherkin-utils'
import * as messages from '@cucumber/messages'

import EmptyPickleTestStep from './EmptyPickleTestStep'
import { MakeErrorMessage } from './ErrorMessageGenerator'
import IClock from './IClock'
import IStopwatch from './IStopwatch'
Expand All @@ -27,21 +26,6 @@ export default function makeTestCase(
makePickleTestStep: MakePickleTestStep,
makeHookStep: MakeHookTestStep
): TestCase {
if (pickle.steps.length === 0) {
const id = newId()
const undefinedStep = new EmptyPickleTestStep(
id,
undefined,
true,
[],
[],
clock,
stopwatch,
makeErrorMessage
)
return new TestCase(newId(), [undefinedStep], pickle.id, clock)
}

const beforeHookSteps = makeHookSteps(
pickle,
beforeHooks,
Expand Down
12 changes: 9 additions & 3 deletions test/makeTestCaseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('makeTestCase', () => {
})

context('when the pickle has no steps', () => {
it('generates a synthetic undefined test step', async () => {
it('generates an empty test case', async () => {
// See https://github.com/cucumber/cucumber/issues/249
const pickle: messages.Pickle = {
id: 'some-id',
Expand Down Expand Up @@ -69,8 +69,14 @@ describe('makeTestCase', () => {
const messageList: messages.Envelope[] = []
const listener: EnvelopeListener = (message: messages.Envelope) =>
messageList.push(message)
await testCase.execute(listener, 0, false, 'some-test-case-started-id')
assert.strictEqual(messageList.length, 4)
const status = await testCase.execute(
listener,
0,
false,
'some-test-case-started-id'
)
assert.strictEqual(status, messages.TestStepResultStatus.UNKNOWN)
assert.strictEqual(messageList.length, 2)
})
})

Expand Down

0 comments on commit efa0754

Please sign in to comment.