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

Step regexp regression in v6 when value is empty #1329

Closed
fmagaldea opened this issue Nov 18, 2019 · 2 comments
Closed

Step regexp regression in v6 when value is empty #1329

fmagaldea opened this issue Nov 18, 2019 · 2 comments
Labels
🐛 bug Defect / Bug

Comments

@fmagaldea
Copy link

Context

  • Cucumber version: 6.0.5
  • Node version: 13.1.0,
  • Operating system: macOS 10.13.3 / same on circleci image node 13.1.0

Notice

This may be an issue on cucumber-expression, but I'm not sure.

Description

With cucumber-js version 5.1.0, the regexp ([^"]*) was detected as an empty string if in the feature file it was empty.
As of version 6, it's null.

Example

  1. Let's define the step:
const {When} = require('cucumber');

When(/^The value equals "([^"]*)"$/, async function(value) {
  console.log(value);
});
  1. Let's call the step:
    The value equals ""
  2. The console output is:
    null
    whereas it should just log an empty string.
@bailejl
Copy link

bailejl commented Feb 17, 2020

We have the same issue. Our steps with "" use to return an empty string in the step, now we get null. Based on the Cucumber docs, we should get an empty string, link below.

Our version of Cucumber is 6.0.5.

https://cucumber.io/docs/cucumber/cucumber-expressions/#parameter-types

@pciruzzi
Copy link

Hi! We have a similar issue with the new cucumber version 6, which was working on 5.1.0. We had an step definition:

Given(/^(?:there are )?the following "([^"]+)" entities( on "([^"]+)" database)?:$/, function expectEntities(
  entityName,
  databaseName,
  entities,
)

Before, when using it like:

Given the following "foo" entities:

databaseName was undefined, but now it's giving a null. This is particularly messing things up, because we were relying on that parameter to call a function which has a default value. Now, as it's getting null instead of undefined, it's trying to use null instead of the default value.

@davidjgoss davidjgoss self-assigned this Feb 19, 2020
@aslakhellesoy aslakhellesoy transferred this issue from cucumber/cucumber-js Feb 2, 2021
@davidjgoss davidjgoss removed their assignment Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug
Projects
None yet
Development

No branches or pull requests

5 participants