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

fix support code line and uri references #881

Merged
merged 4 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* Add `--i18n-languages` and `--i18n-keywords <ISO 639-1>` CLI options
* Add `BeforeAll` / `AfterAll` hooks to replace uses of `registerHandler`

#### Bug Fixes

* Fix support code line and uri references when using direct imports

### [2.3.1](https://github.com/cucumber/cucumber-js/compare/v2.3.0...v2.3.1) (2017-06-09)

#### New Features
Expand Down
255 changes: 0 additions & 255 deletions features/core_with_direct_imports.feature

This file was deleted.

46 changes: 46 additions & 0 deletions features/direct_imports.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Feature: Core feature elements execution using direct imports
In order to have clean syntax for automated acceptance tests
As a developer
I want Cucumber to run core feature elements using direct imports

Scenario: passing
Given a file named "features/a.feature" with:
"""
Feature: some feature
Scenario:
Given a step passes
"""
And a file named "features/step_definitions/cucumber_steps.js" with:
"""
import {Given} from 'cucumber'

Given(/^a step passes$/, function() {});
"""
When I run cucumber-js
Then it passes

Scenario: failing
Given a file named "features/a.feature" with:
"""
Feature: some feature
Scenario:
Given a step fails
"""
And a file named "features/step_definitions/cucumber_steps.js" with:
"""
import {Given} from 'cucumber'

Given(/^a step fails$/, function(callback) {
callback(new Error('my error'))
});
"""
When I run cucumber-js
Then it fails
And the step "a step fails" failed with:
"""
my error
"""
And the output contains the text:
"""
features/step_definitions/cucumber_steps.js:3
"""
10 changes: 3 additions & 7 deletions src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import path from 'path'
import Promise from 'bluebird'
import Runtime from '../runtime'
import ScenarioFilter from '../scenario_filter'
import SupportCodeFns from '../support_code_fns'
import SupportCodeLibraryBuilder from '../support_code_library/builder'
import * as I18n from './i18n'
import supportCodeLibraryBuilder from '../support_code_library_builder'

export default class Cli {
constructor({ argv, cwd, stdout }) {
Expand Down Expand Up @@ -52,12 +51,9 @@ export default class Cli {
}

getSupportCodeLibrary(supportCodePaths) {
SupportCodeFns.reset()
supportCodeLibraryBuilder.reset(this.cwd)
supportCodePaths.forEach(codePath => require(codePath))
return SupportCodeLibraryBuilder.build({
cwd: this.cwd,
fns: SupportCodeFns.get()
})
return supportCodeLibraryBuilder.finalize()
}

async run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import DataTable from '../../models/step_arguments/data_table'
import DocString from '../../models/step_arguments/doc_string'
import KeywordType from '../../keyword_type'
import StepDefinitionSnippetBuilder from './'
import TransformLookupBuilder from '../../support_code_library/parameter_type_registry_builder'
import TransformLookupBuilder from '../../support_code_library_builder/parameter_type_registry_builder'

describe('StepDefinitionSnippetBuilder', function() {
beforeEach(function() {
Expand Down
Loading