Skip to content

Commit

Permalink
fix(cucumber): off-by-one error in report (#2987)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs committed Jul 2, 2021
1 parent dd2276e commit 5e184c1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
23 changes: 21 additions & 2 deletions packages/cucumber-runner/package.json
Expand Up @@ -10,8 +10,27 @@
"test:integration": "mocha --no-timeout 'dist/test/integration/**/*.js'",
"stryker": "node ../core/bin/stryker run"
},
"keywords": [],
"author": "",
"repository": {
"type": "git",
"url": "https://github.com/stryker-mutator/stryker-js.git",
"directory": "packages/cucumber-runner"
},
"engines": {
"node": ">=12"
},
"keywords": [
"stryker",
"cucumber",
"@stryker-mutator/test-runner-plugin"
],
"publishConfig": {
"access": "public"
},
"bugs": {
"url": "https://github.com/stryker-mutator/stryker-js/issues"
},
"homepage": "https://stryker-mutator.io/docs/stryker-js/cucumber-runner",
"author": "Nico Jansen <jansennico@gmail.com>",
"license": "ISC",
"devDependencies": {
"@cucumber/cucumber": "^7.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cucumber-runner/src/stryker-formatter.ts
Expand Up @@ -215,7 +215,7 @@ function determinePosition(

function toPosition(location: Location): Position {
return {
line: location.line,
line: location.line - 1, // StrykerJS works 0- based internally
column: location.column ?? 0,
};
}
Expand Down
Expand Up @@ -39,15 +39,15 @@ describe('Running in an example project', () => {
id: `${fileName}:7`,
fileName,
name: 'Feature: Simple maths -- Scenario: easy maths',
startPosition: { line: 7, column: 3 },
startPosition: { line: 6, column: 3 },
},
{
status: TestStatus.Success,
id: `${fileName}:19`,
name: 'Feature: Simple maths -- Scenario Outline: much more complex stuff [Example L19]',
fileName,
startPosition: {
line: 19,
line: 18,
column: 7,
},
},
Expand All @@ -57,7 +57,7 @@ describe('Running in an example project', () => {
name: 'Feature: Simple maths -- Scenario Outline: much more complex stuff [Example L20]',
fileName,
startPosition: {
line: 20,
line: 19,
column: 7,
},
},
Expand All @@ -68,7 +68,7 @@ describe('Running in an example project', () => {
name: 'Feature: Simple maths -- Scenario: static math',
startPosition: {
column: 3,
line: 22,
line: 21,
},
},
];
Expand Down
Expand Up @@ -41,7 +41,7 @@ describe('Running cucumber when steps are failing', () => {
id: `${fileName}:4`,
status: TestStatus.Failed,
failureMessage: 'Error: Failed step',
startPosition: { line: 4, column: 3 },
startPosition: { line: 3, column: 3 },
},
]);
});
Expand Down

0 comments on commit 5e184c1

Please sign in to comment.