mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
refactor: extract parsing java StackTraceElement to allow improving
This commit is contained in:
parent
b41f730922
commit
e5edb614dd
3 changed files with 66 additions and 4 deletions
40
__tests__/java-stack-trace-element-parser.test.ts
Normal file
40
__tests__/java-stack-trace-element-parser.test.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import {parseStackTraceElement} from '../src/parsers/java-junit/java-stack-trace-element-parser'
|
||||
|
||||
describe('parseStackTraceLine tests', () => {
|
||||
it('empty line is not parsed', async () => {
|
||||
const line = ''
|
||||
expect(parseStackTraceElement(line)).toBe(undefined)
|
||||
})
|
||||
|
||||
describe('java class', () => {
|
||||
it('simple', async () => {
|
||||
const line =
|
||||
'at org.apache.pulsar.AddMissingPatchVersionTest.testVersionStrings(AddMissingPatchVersionTest.java:29)'
|
||||
expect(parseStackTraceElement(line)).toEqual({
|
||||
tracePath: 'org.apache.pulsar.AddMissingPatchVersionTest.testVersionStrings',
|
||||
fileName: 'AddMissingPatchVersionTest.java',
|
||||
lineStr: '29'
|
||||
})
|
||||
})
|
||||
|
||||
it('inner class', async () => {
|
||||
const line = 'at com.foo.Main$Inner.run(Main.java:29)'
|
||||
expect(parseStackTraceElement(line)).toEqual({
|
||||
tracePath: 'com.foo.Main$Inner.run',
|
||||
fileName: 'Main.java',
|
||||
lineStr: '29'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Kotlin class', () => {
|
||||
it('method name containing whitespaces', async () => {
|
||||
const line = 'at com.foo.Main.method with whitespaces(Main.kt:18)'
|
||||
expect(parseStackTraceElement(line)).toEqual({
|
||||
tracePath: 'com.foo.Main.method with whitespaces',
|
||||
fileName: 'Main.kt',
|
||||
lineStr: '18'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue