Skip to content

Commit

Permalink
Fix filename and line for tests with suffix (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmisur authored Mar 24, 2021
1 parent d63a9f5 commit a915ba6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
key: ${{ runner.os }}-main-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-main-maven-
- uses: actions/setup-java@v1
with:
java-version: 8
- run: cd tests && mvn clean test --batch-mode -Dmaven.test.failure.ignore=true
- uses: scacap/action-surefire-report@master
if: endsWith(github.ref, 'master') == false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="pro.taskana.common.api.ListUtilTest" time="0.063" tests="1" errors="0" skipped="0" failures="1">
<testcase name="should_SplitListIntoChunks_When_CallingPartitionBasedOnSize" classname="pro.taskana.common.api.ListUtilTest" time="0.045">
<testcase name="should_SplitListIntoChunks_When_CallingPartitionBasedOnSize" classname="pro.taskana.common.api.ListUtilTest(H2)" time="0.045">
<failure type="java.lang.AssertionError"><![CDATA[java.lang.AssertionError:
Expected size:<11> but was:<10> in:
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15098,7 +15098,8 @@ const fs = __webpack_require__(747);
const parser = __webpack_require__(477);

const resolveFileAndLine = (file, classname, output) => {
const filename = file ? file : classname.split('.').slice(-1)[0];
// extract filename from classname and remove suffix
const filename = file ? file : classname.split('.').slice(-1)[0].split('(')[0];
const matches = output.match(new RegExp(`${filename}.*?:\\d+`, 'g'));
if (!matches) return { filename: filename, line: 1 };

Expand Down
3 changes: 2 additions & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const fs = require('fs');
const parser = require('xml-js');

const resolveFileAndLine = (file, classname, output) => {
const filename = file ? file : classname.split('.').slice(-1)[0];
// extract filename from classname and remove suffix
const filename = file ? file : classname.split('.').slice(-1)[0].split('(')[0];
const matches = output.match(new RegExp(`${filename}.*?:\\d+`, 'g'));
if (!matches) return { filename: filename, line: 1 };

Expand Down
2 changes: 1 addition & 1 deletion utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('parseFile', () => {
});
it('should parse custom report with details as an array', async () => {
const { count, skipped, annotations } = await parseFile(
'custom_reports/TEST-pro.taskana.common.api.ListUtilTest.xml'
'custom_reports/TEST-pro.taskana.common.api.ListUtilTest-H2.xml'
);

expect(count).toBe(1);
Expand Down

0 comments on commit a915ba6

Please sign in to comment.