cucumber-attic / gherkin2

A fast Gherkin parser in Ragel (The parser behind Cucumber)
MIT License
382 stars 221 forks source link

NullPointerException when 'type' property is missing #349

Closed rowysock closed 7 years ago

rowysock commented 7 years ago

I'm using Cucumber JS 2.0.0-rc.9. As of recently JSON Formatter dropped type property (https://github.com/cucumber/cucumber-js/issues/813). Genrated output now looks something like:

[
  {
    "description": "Some description",
    "keyword": "Feature",
    "line": 2,
    "name": "Running Cucumber",
    "tags": [],
    "uri": "/uri/todo.feature",
    "elements": [
      {
        "keyword": "Scenario",
        "line": 7,
        "name": "Cucumber Test",
        "tags": [],
        "id": "cucumber-test",
        "steps": [
          {
            "arguments": [],
            "keyword": "Given ",
            "name": "I go to \"https://somepage.org/\"",
            "result": {
              "status": "passed",
              "duration": 4278
            },
            "line": 8,
            "match": {
              "location": "/uri/steps.ts:12"
            }
          }
        ]
      }
    ],
    "id": "running-cucumber"
  }
]

Because of that JSONParser is failing with following message:

Exception in thread "main" java.lang.NullPointerException
    at gherkin.JSONParser.featureElement(JSONParser.java:66)
    at gherkin.JSONParser.parse(JSONParser.java:46)
aslakhellesoy commented 7 years ago

Cucumber.js is using Gherkin v4, which lives in the cucumber/cucumber monorepo. Please post your bug there. This repo is no longer maintained.

aslakhellesoy commented 7 years ago

Wait a minute - your error doesn't seem to have anything to do with the gherkin parser (which parses .feature files).

This is a bug with cucumber/cucumber-js - that's where you should report this.

In any case, we probably won't fix this as we're planning on retiring the JSON formatter output in favour of the Cucumber Event protocol.

https://docs.cucumber.io/event-protocol/