Skip to content

Cucumber's own features fail when parent directory contains parentheses #1735

Closed
@eoola

Description

@eoola

Describe the bug
Whenever the parent directory has parentheses in its name, I noticed the cucumber features tests start to fail. I also noticed that in the tests that are run, the path for the parent directory drops the parentheses from the path name. For the above reason, the path can not be found for a specified directory.

22) Scenario:  # features/usage_json_formatter.feature:8
    ✔ Before # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13
    ✔ Given a file named "features/a.feature" with: # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13
        """
        Feature: a feature
          Scenario: a scenario
            Given step A
            And step A
            When step B
            Then step C
        """
    ✔ And a file named "features/step_definitions/steps.js" with: # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13
        """
        const {When} = require('@cucumber/cucumber')

        When('step A', function() {});
        When('step B', function() {});
        When('step C', function() {});
        When(/step D/, function() {});
        """
    ✔ When I run cucumber-js with `--format usage-json` # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13
    ✖ Then it outputs the usage data: # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13
        | PATTERN | PATTERN_TYPE       | URI                                | LINE | NUMBER OF MATCHES |
        | step A  | CucumberExpression | features/step_definitions/steps.js | 3    | 2                 |
        | step B  | CucumberExpression | features/step_definitions/steps.js | 4    | 1                 |
        | step C  | CucumberExpression | features/step_definitions/steps.js | 5    | 1                 |
        | step D  | RegularExpression  | features/step_definitions/steps.js | 6    | 0                 |
        AssertionError
            + expected - actual

            -13
            +3

            at /Users/emmanuelola/Documents/Cucumber (x)/cucumber-js/features/step_definitions/usage_json_steps.ts:15:30
            at Array.forEach (<anonymous>)
            at World.<anonymous> (/Users/emmanuelola/Documents/Cucumber (x)/cucumber-js/features/step_definitions/usage_json_steps.ts:9:18)
    ✔ After # ../../Cucumber x/cucumber-js/src/support_code_library_builder/build_helpers.ts:13

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'the root directory for the project'
  2. Add a parent directory with a parentheses in its name (include some letters within the parentheses)
  3. Open the project in your desired IDE
  4. Run the tests
  5. See error

Expected behavior
Passing tests

Screenshots
Untitled

Desktop (please complete the following information):

  • OS: macOS Big Sur 11.4
  • Version: Main Repository Branch

Additional context
Trying to run tests to contribute to cucumber-js with @mattwynne as part of the Cucumber first timers mob and the folder where I keep my code happens to have parentheses in its name. For more context, this is not the folder shown in the screenshot, that's simply provided for testing purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🏦 debtTech debt✅ acceptedThe core team has agreed that it is a good idea to fix this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions