You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The message output from cucumber-js contains a mixture of absolute and relative uris. The ones with absolute are the ones from Gherkin:
source
gherkinDocument
pickle
Step definitions and hooks by contrast have relative uris.
Example message output (some removed for brevity):
{"meta":{"protocolVersion":"13.2.1","implementation":{"name":"cucumber-js","version":"7.0.0"},"runtime":{"name":"node.js","version":"12.18.3"},"os":{"name":"darwin","version":"19.5.0"},"cpu":{"name":"x64"}}}
{"source":{"uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","data":"Feature: Core feature elements execution\n In order to have automated acceptance tests\n As a developer\n I want Cucumber to run core feature elements\n\n Scenario: simple\n Given a file named \"features/a.feature\" with:\n \"\"\"\n Feature: some feature\n Scenario:\n Given a step passes\n When a step passes\n Then a step passes\n \"\"\"\n And a file named \"features/step_definitions/cucumber_steps.js\" with:\n \"\"\"\n const {Given} = require('@cucumber/cucumber')\n\n Given(/^a step passes$/, function() {});\n \"\"\"\n When I run cucumber-js\n Then it passes\n\n Scenario: Given, When, Then, And and But steps\n Given a file named \"features/a.feature\" with:\n \"\"\"\n Feature: Given, When, Then, And and But step execution\n Scenario: All kinds of steps\n Given a \"Given\" step passes\n When a \"When\" step passes\n Then a \"Then\" step passes\n\n Scenario: All kinds of steps with And's and But's\n Given a \"Given\" step passes\n And a \"Given\" step passes\n But a \"Given\" step passes\n When a \"When\" step passes\n And a \"When\" step passes\n But a \"When\" step passes\n Then a \"Then\" step passes\n And a \"Then\" step passes\n But a \"Then\" step passes\n \"\"\"\n And a file named \"features/step_definitions/cucumber_steps.js\" with:\n \"\"\"\n const {Given, Then, When} = require('@cucumber/cucumber')\n\n Given(/^a \"Given\" step passes$/, function() {})\n When(/^a \"When\" step passes$/, function() {})\n Then(/^a \"Then\" step passes$/, function() {})\n \"\"\"\n When I run cucumber-js\n Then it passes\n\n Scenario: Step definition body is executed\n Given a file named \"features/a.feature\" with:\n \"\"\"\n Feature: Step definition body execution\n Scenario: Step definition body is executed once\n When I call a watched step\n Then the watched step should have been called 1 time\n\n Scenario: Step definition body is executed several times\n When I call a watched step\n And I call a watched step\n And I call a watched step\n Then the watched step should have been called 3 times\n \"\"\"\n And a file named \"features/step_definitions/cucumber_steps.js\" with:\n \"\"\"\n const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\n const assert = require('assert')\n\n setWorldConstructor(function () {\n this.count = 0\n })\n\n When(/^I call a watched step$/, function() {\n this.count += 1\n })\n\n Then(/^the watched step should have been called (\\d+) times?$/, function(count){\n assert.equal(this.count, parseInt(count))\n })\n \"\"\"\n When I run cucumber-js\n Then it passes\n\n Scenario: Steps accepting parameters\n Given a file named \"features/a.feature\" with:\n \"\"\"\n Feature: Steps receiving parameters\n Scenario: Single-parameter step\n When I call a step with \"a parameter\"\n Then the 1st received parameter should be \"a parameter\"\n\n Scenario: Three-parameter step\n When I call a step with \"one\", \"two\" and \"three\"\n Then the 1st received parameter should be \"one\"\n And the 2nd received parameter should be \"two\"\n And the 3rd received parameter should be \"three\"\n \"\"\"\n And a file named \"features/step_definitions/cucumber_steps.js\" with:\n \"\"\"\n const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\n const assert = require('assert')\n\n setWorldConstructor(function () {\n this.parameters = {}\n })\n\n When(/^I call a step with \"([^\"]*)\"$/, function(arg) {\n this.parameters['1'] = arg\n })\n\n When(/^I call a step with \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$/, function(arg1, arg2, arg3) {\n this.parameters['1'] = arg1\n this.parameters['2'] = arg2\n this.parameters['3'] = arg3\n })\n\n Then(/^the (\\d+)(?:st|nd|rd) received parameter should be \"([^\"]*)\"$/, function(index, arg){\n assert.equal(this.parameters[index], arg)\n })\n \"\"\"\n When I run cucumber-js\n Then it passes\n","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","feature":{"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Core feature elements execution","description":" In order to have automated acceptance tests\n As a developer\n I want Cucumber to run core feature elements","children":[{"scenario":{"location":{"line":6,"column":3},"keyword":"Scenario","name":"simple","steps":[{"location":{"line":7,"column":5},"keyword":"Given ","text":"a file named \"features/a.feature\" with:","docString":{"location":{"line":8,"column":7},"content":"Feature: some feature\n Scenario:\n Given a step passes\n When a step passes\n Then a step passes","delimiter":"\"\"\""},"id":"c5ca6f00-3a8a-499b-b4e6-03b963136e9c"},{"location":{"line":15,"column":5},"keyword":"And ","text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","docString":{"location":{"line":16,"column":7},"content":"const {Given} = require('@cucumber/cucumber')\n\nGiven(/^a step passes$/, function() {});","delimiter":"\"\"\""},"id":"8a414af7-f662-4dd4-8ac8-bdf088ebbc9f"},{"location":{"line":21,"column":5},"keyword":"When ","text":"I run cucumber-js","id":"35f071fa-dcda-4bb7-8ab9-85a35bf7b5e3"},{"location":{"line":22,"column":5},"keyword":"Then ","text":"it passes","id":"980752ef-f065-4f35-a9da-443bef54e415"}],"id":"ba30dfc3-3d90-4959-9145-6e1bedcc38bf"}},{"scenario":{"location":{"line":24,"column":3},"keyword":"Scenario","name":"Given, When, Then, And and But steps","steps":[{"location":{"line":25,"column":5},"keyword":"Given ","text":"a file named \"features/a.feature\" with:","docString":{"location":{"line":26,"column":7},"content":"Feature: Given, When, Then, And and But step execution\n Scenario: All kinds of steps\n Given a \"Given\" step passes\n When a \"When\" step passes\n Then a \"Then\" step passes\n\n Scenario: All kinds of steps with And's and But's\n Given a \"Given\" step passes\n And a \"Given\" step passes\n But a \"Given\" step passes\n When a \"When\" step passes\n And a \"When\" step passes\n But a \"When\" step passes\n Then a \"Then\" step passes\n And a \"Then\" step passes\n But a \"Then\" step passes","delimiter":"\"\"\""},"id":"e230fede-1d26-42a8-8241-c82732d4b795"},{"location":{"line":44,"column":5},"keyword":"And ","text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","docString":{"location":{"line":45,"column":7},"content":"const {Given, Then, When} = require('@cucumber/cucumber')\n\nGiven(/^a \"Given\" step passes$/, function() {})\nWhen(/^a \"When\" step passes$/, function() {})\nThen(/^a \"Then\" step passes$/, function() {})","delimiter":"\"\"\""},"id":"4e4f8332-a8ed-4231-9149-86c9fe7601be"},{"location":{"line":52,"column":5},"keyword":"When ","text":"I run cucumber-js","id":"190d315f-4738-421d-8d66-2d16b84c869e"},{"location":{"line":53,"column":5},"keyword":"Then ","text":"it passes","id":"6a4b25a3-9a3e-47a0-8e48-695996863f0e"}],"id":"32d0bfc3-3f31-4ac1-bf91-754111c7e2cd"}},{"scenario":{"location":{"line":55,"column":3},"keyword":"Scenario","name":"Step definition body is executed","steps":[{"location":{"line":56,"column":5},"keyword":"Given ","text":"a file named \"features/a.feature\" with:","docString":{"location":{"line":57,"column":7},"content":"Feature: Step definition body execution\n Scenario: Step definition body is executed once\n When I call a watched step\n Then the watched step should have been called 1 time\n\n Scenario: Step definition body is executed several times\n When I call a watched step\n And I call a watched step\n And I call a watched step\n Then the watched step should have been called 3 times","delimiter":"\"\"\""},"id":"4a2e9939-6269-441a-be6a-6870462a613a"},{"location":{"line":69,"column":5},"keyword":"And ","text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","docString":{"location":{"line":70,"column":7},"content":"const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\nconst assert = require('assert')\n\nsetWorldConstructor(function () {\n this.count = 0\n})\n\nWhen(/^I call a watched step$/, function() {\n this.count += 1\n})\n\nThen(/^the watched step should have been called (\\d+) times?$/, function(count){\n assert.equal(this.count, parseInt(count))\n})","delimiter":"\"\"\""},"id":"72451a19-0268-437b-afe6-477820169140"},{"location":{"line":86,"column":5},"keyword":"When ","text":"I run cucumber-js","id":"8ffa8d8a-4f23-4820-a691-9e27ff2afad3"},{"location":{"line":87,"column":5},"keyword":"Then ","text":"it passes","id":"860d7569-e6cb-4cb0-8bef-bac859693576"}],"id":"1d865a1f-f695-4f79-a473-4870490e5bcb"}},{"scenario":{"location":{"line":89,"column":3},"keyword":"Scenario","name":"Steps accepting parameters","steps":[{"location":{"line":90,"column":5},"keyword":"Given ","text":"a file named \"features/a.feature\" with:","docString":{"location":{"line":91,"column":7},"content":"Feature: Steps receiving parameters\n Scenario: Single-parameter step\n When I call a step with \"a parameter\"\n Then the 1st received parameter should be \"a parameter\"\n\n Scenario: Three-parameter step\n When I call a step with \"one\", \"two\" and \"three\"\n Then the 1st received parameter should be \"one\"\n And the 2nd received parameter should be \"two\"\n And the 3rd received parameter should be \"three\"","delimiter":"\"\"\""},"id":"2bfd1421-feec-4b46-8ac6-da780d2b9f6c"},{"location":{"line":103,"column":5},"keyword":"And ","text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","docString":{"location":{"line":104,"column":7},"content":"const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\nconst assert = require('assert')\n\nsetWorldConstructor(function () {\n this.parameters = {}\n})\n\nWhen(/^I call a step with \"([^\"]*)\"$/, function(arg) {\n this.parameters['1'] = arg\n})\n\nWhen(/^I call a step with \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$/, function(arg1, arg2, arg3) {\n this.parameters['1'] = arg1\n this.parameters['2'] = arg2\n this.parameters['3'] = arg3\n})\n\nThen(/^the (\\d+)(?:st|nd|rd) received parameter should be \"([^\"]*)\"$/, function(index, arg){\n assert.equal(this.parameters[index], arg)\n})","delimiter":"\"\"\""},"id":"c739221e-6252-4c2b-94d4-14c09b80001b"},{"location":{"line":126,"column":5},"keyword":"When ","text":"I run cucumber-js","id":"29ec48e3-085d-4f12-9cd4-cafc8898b627"},{"location":{"line":127,"column":5},"keyword":"Then ","text":"it passes","id":"8127b0fa-37cd-4574-8c2f-75376ede3c95"}],"id":"891d5826-b41c-42f3-9cb2-21bcb8a898f3"}}]}}}
{"pickle":{"id":"e6fe4686-d934-4d59-96b3-670d586b0f6c","uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","name":"simple","language":"en","steps":[{"text":"a file named \"features/a.feature\" with:","argument":{"docString":{"content":"Feature: some feature\n Scenario:\n Given a step passes\n When a step passes\n Then a step passes"}},"id":"e02bad80-ef78-4d72-bd93-5783ec08ba26","astNodeIds":["c5ca6f00-3a8a-499b-b4e6-03b963136e9c"]},{"text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","argument":{"docString":{"content":"const {Given} = require('@cucumber/cucumber')\n\nGiven(/^a step passes$/, function() {});"}},"id":"ecd9e965-4f67-485b-a021-df13154a28a5","astNodeIds":["8a414af7-f662-4dd4-8ac8-bdf088ebbc9f"]},{"text":"I run cucumber-js","id":"c1005a66-1f63-4ab0-9cb5-aaa16ce4a169","astNodeIds":["35f071fa-dcda-4bb7-8ab9-85a35bf7b5e3"]},{"text":"it passes","id":"12db0843-8483-4cff-91d8-671bdccea83d","astNodeIds":["980752ef-f065-4f35-a9da-443bef54e415"]}],"astNodeIds":["ba30dfc3-3d90-4959-9145-6e1bedcc38bf"]}}
{"pickle":{"id":"375d8512-bc83-44f0-b412-ae1e9ac52664","uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","name":"Given, When, Then, And and But steps","language":"en","steps":[{"text":"a file named \"features/a.feature\" with:","argument":{"docString":{"content":"Feature: Given, When, Then, And and But step execution\n Scenario: All kinds of steps\n Given a \"Given\" step passes\n When a \"When\" step passes\n Then a \"Then\" step passes\n\n Scenario: All kinds of steps with And's and But's\n Given a \"Given\" step passes\n And a \"Given\" step passes\n But a \"Given\" step passes\n When a \"When\" step passes\n And a \"When\" step passes\n But a \"When\" step passes\n Then a \"Then\" step passes\n And a \"Then\" step passes\n But a \"Then\" step passes"}},"id":"76d4651c-1131-4177-bcc6-1fbcdd0bb15d","astNodeIds":["e230fede-1d26-42a8-8241-c82732d4b795"]},{"text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","argument":{"docString":{"content":"const {Given, Then, When} = require('@cucumber/cucumber')\n\nGiven(/^a \"Given\" step passes$/, function() {})\nWhen(/^a \"When\" step passes$/, function() {})\nThen(/^a \"Then\" step passes$/, function() {})"}},"id":"1e9de4a3-dcd5-4168-b98c-96e76a23a393","astNodeIds":["4e4f8332-a8ed-4231-9149-86c9fe7601be"]},{"text":"I run cucumber-js","id":"f297f72a-6837-4ee5-90d3-6a81ee45c97c","astNodeIds":["190d315f-4738-421d-8d66-2d16b84c869e"]},{"text":"it passes","id":"2624643b-f2ff-4666-85ea-f7b2dc0bc8d6","astNodeIds":["6a4b25a3-9a3e-47a0-8e48-695996863f0e"]}],"astNodeIds":["32d0bfc3-3f31-4ac1-bf91-754111c7e2cd"]}}
{"pickle":{"id":"6420b7c7-303e-49e2-9482-e35ad41c038b","uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","name":"Step definition body is executed","language":"en","steps":[{"text":"a file named \"features/a.feature\" with:","argument":{"docString":{"content":"Feature: Step definition body execution\n Scenario: Step definition body is executed once\n When I call a watched step\n Then the watched step should have been called 1 time\n\n Scenario: Step definition body is executed several times\n When I call a watched step\n And I call a watched step\n And I call a watched step\n Then the watched step should have been called 3 times"}},"id":"d5ae2c09-a927-4a33-ba99-f768428e2d7d","astNodeIds":["4a2e9939-6269-441a-be6a-6870462a613a"]},{"text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","argument":{"docString":{"content":"const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\nconst assert = require('assert')\n\nsetWorldConstructor(function () {\n this.count = 0\n})\n\nWhen(/^I call a watched step$/, function() {\n this.count += 1\n})\n\nThen(/^the watched step should have been called (\\d+) times?$/, function(count){\n assert.equal(this.count, parseInt(count))\n})"}},"id":"aee4a5bc-54f8-4b9d-b9b7-2e17143a054d","astNodeIds":["72451a19-0268-437b-afe6-477820169140"]},{"text":"I run cucumber-js","id":"8eb5bb1c-aa1c-4619-9027-2fc658a9ed98","astNodeIds":["8ffa8d8a-4f23-4820-a691-9e27ff2afad3"]},{"text":"it passes","id":"d6411a86-672b-4395-9fd3-527ad3e600b2","astNodeIds":["860d7569-e6cb-4cb0-8bef-bac859693576"]}],"astNodeIds":["1d865a1f-f695-4f79-a473-4870490e5bcb"]}}
{"pickle":{"id":"632178ad-d5e9-4e2a-a825-b2155ea0de7a","uri":"/Users/davidgoss/Documents/Projects/cjs/features/core.feature","name":"Steps accepting parameters","language":"en","steps":[{"text":"a file named \"features/a.feature\" with:","argument":{"docString":{"content":"Feature: Steps receiving parameters\n Scenario: Single-parameter step\n When I call a step with \"a parameter\"\n Then the 1st received parameter should be \"a parameter\"\n\n Scenario: Three-parameter step\n When I call a step with \"one\", \"two\" and \"three\"\n Then the 1st received parameter should be \"one\"\n And the 2nd received parameter should be \"two\"\n And the 3rd received parameter should be \"three\""}},"id":"f460590e-f3b8-4dcc-9d34-ade66720877f","astNodeIds":["2bfd1421-feec-4b46-8ac6-da780d2b9f6c"]},{"text":"a file named \"features/step_definitions/cucumber_steps.js\" with:","argument":{"docString":{"content":"const {setWorldConstructor, Then, When} = require('@cucumber/cucumber')\nconst assert = require('assert')\n\nsetWorldConstructor(function () {\n this.parameters = {}\n})\n\nWhen(/^I call a step with \"([^\"]*)\"$/, function(arg) {\n this.parameters['1'] = arg\n})\n\nWhen(/^I call a step with \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\"$/, function(arg1, arg2, arg3) {\n this.parameters['1'] = arg1\n this.parameters['2'] = arg2\n this.parameters['3'] = arg3\n})\n\nThen(/^the (\\d+)(?:st|nd|rd) received parameter should be \"([^\"]*)\"$/, function(index, arg){\n assert.equal(this.parameters[index], arg)\n})"}},"id":"2b82dcc9-c095-4a42-9499-4b7acd6e09a2","astNodeIds":["c739221e-6252-4c2b-94d4-14c09b80001b"]},{"text":"I run cucumber-js","id":"eec3fcd9-de72-4f3f-877c-882293b047d3","astNodeIds":["29ec48e3-085d-4f12-9cd4-cafc8898b627"]},{"text":"it passes","id":"a9b04175-9b6f-4dd6-9c0f-c60384027f62","astNodeIds":["8127b0fa-37cd-4574-8c2f-75376ede3c95"]}],"astNodeIds":["891d5826-b41c-42f3-9cb2-21bcb8a898f3"]}}
{"stepDefinition":{"id":"2fb2916c-cb5f-4234-93fe-def964fddfde","pattern":{"source":"my env includes {string}","type":"CUCUMBER_EXPRESSION"},"sourceReference":{"uri":"features/step_definitions/cli_steps.ts","location":{"line":15}}}}
{"hook":{"id":"3d552eea-142f-4390-b2c5-5b7fc7217b8a","tagExpression":"@debug","sourceReference":{"uri":"features/support/hooks.ts","location":{"line":12}}}}
The absolute uris aren't great on the HTML formatter output:
For short term, we could update our code to transition absolute to relative paths but I think it probably makes sense to do this in gherkin (maybe allow passing in a root dir that paths will be relative to)
FWIW did a quick experiment with just passing the relative paths to Gherkin from our side, it seems to work correctly with manual testing but many feature tests fail.
The message output from cucumber-js contains a mixture of absolute and relative uris. The ones with absolute are the ones from Gherkin:
source
gherkinDocument
pickle
Step definitions and hooks by contrast have relative uris.
Example message output (some removed for brevity):
The absolute uris aren't great on the HTML formatter output:
cc @charlierudolph
The text was updated successfully, but these errors were encountered: