From 562e0277515cae408f30ad1ea2d6dea44fc1df87 Mon Sep 17 00:00:00 2001 From: Ashley Taylor Date: Wed, 8 Jul 2020 09:02:05 +1200 Subject: [PATCH] get tests to pass --- index.js | 3 +-- index.test.js | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 43dec7f5..a4cbb39f 100644 --- a/index.js +++ b/index.js @@ -153,7 +153,6 @@ async function findTestLocation(testReportFile, testcase) { bestRelativePathLength = candidateRelativeLength; } } - let line = 0; if (bestFilePath !== undefined) { const file = await fs.promises.readFile(bestFilePath, { @@ -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; } diff --git a/index.test.js b/index.test.js index 215b0458..384e3195 100644 --- a/index.test.js +++ b/index.test.js @@ -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(