Skip to content

Commit

Permalink
get tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-taylor committed Jul 7, 2020
1 parent cdb4f1a commit 562e027
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ async function findTestLocation(testReportFile, testcase) {
bestRelativePathLength = candidateRelativeLength;
}
}

let line = 0;
if (bestFilePath !== undefined) {
const file = await fs.promises.readFile(bestFilePath, {
Expand All @@ -162,7 +161,7 @@ async function findTestLocation(testReportFile, testcase) {
//TODO: make this better won't deal with methods with arguments etc
const lines = file.split("\n");
for (let i = 0; i < lines.length; i++) {
if (lines[i].indexOf(testcase.name) >= 0) {
if (lines[i].indexOf(testcase.$.name) >= 0) {
line = i + 1; // +1 because the first line is 1 not 0
break;
}
Expand Down
6 changes: 4 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ describe("find test location", () => {
beforeAll(async () => {
testReportFile = resolve("target/surefire-reports/TEST-dummy.xml");
testCase = {
classname: "org.dummy.ClassTest",
name: "methodTest",
$: {
classname: "org.dummy.ClassTest",
name: "methodTest",
},
};

await addFile(
Expand Down

0 comments on commit 562e027

Please sign in to comment.