Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[YAML] Config cannot be parsed if values are preceded by an indented, commented line #25341

Copy link
Copy link
Closed
@dereklopes

Description

@dereklopes
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? yes
Symfony version 3.4.1
PHP version 5.6.14

My first bug report, sorry if I mess something up or am missing information.

Seemingly after #25241, our YAML config file my work uses for behat testing started throwing this error when being parsed:

In Parser.php line 478:

  Unable to parse at line 14 (near "    baseUri: http://localhost:8080").

Here is our YAML config:

# behat.yml

default:
    gherkin:
        filters:
            tags: "~@platform"
    
    suites:
        webservices:
          paths: [ %paths.base%/webservices ]
          contexts:
            - FeatureContext:
                # Local
                baseUri: http://localhost:8080
                basePath: /1.0

                # Dev
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # QA
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Staging
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Debug
                # debug: true

We have it this way to easily switch environments for testing by commenting/uncommenting values. It worked until yesterday. It still fails if I try to use other baseUri and basePath values and by commenting/uncommenting.

I can get it to work now by removing the leading comment (for example, # Local or # Dev). A working config looks like this:

# behat.yml

default:
    gherkin:
        filters:
            tags: "~@platform"
    
    suites:
        webservices:
          paths: [ %paths.base%/webservices ]
          contexts:
            - FeatureContext:
                baseUri: http://localhost:8080
                basePath: /1.0

                # Dev
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # QA
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Staging
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Debug
                # debug: true

or

# behat.yml

default:
    gherkin:
        filters:
            tags: "~@platform"
    
    suites:
        webservices:
          paths: [ %paths.base%/webservices ]
          contexts:
            - FeatureContext:
                # Local
                # baseUri: http://localhost:8080
                # basePath: /1.0

                baseUri: https://www.exampleurl.com
                basePath: /1.0

                # QA
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Staging
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Debug
                # debug: true

Note that it works with multiple lines of comments and a blank line separating, but not without the separating blank line. As well, it works if you remove the indentation from the comment like so:

# behat.yml

default:
    gherkin:
        filters:
            tags: "~@platform"
    
    suites:
        webservices:
          paths: [ %paths.base%/webservices ]
          contexts:
            - FeatureContext:
# Local
                baseUri: http://localhost:8080
                basePath: /1.0

                # Dev
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # QA
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Staging
                # baseUri: https://www.exampleurl.com
                # basePath: /1.0

                # Debug
                # debug: true

Hopefully this is enough information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.