Fix: Debug.LogError annotation point not parsed correctly
parent
0ff419b913
commit
347771947e
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -248,5 +248,13 @@ at Tests.SetupFailedTest.SetUp () [0x00000] in /github/workspace/unity-project/A
|
|||
expect(result.path).toBe('/github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs');
|
||||
expect(result.line).toBe(10);
|
||||
});
|
||||
|
||||
test('Debug.LogError annotation point', () => {
|
||||
const result = ResultsParser.findAnnotationPoint(
|
||||
`FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:580)`,
|
||||
);
|
||||
expect(result.path).toBe('Assets/Plugins/FMOD/src/RuntimeUtils.cs');
|
||||
expect(result.line).toBe(580);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -127,12 +127,13 @@ const ResultsParser = {
|
|||
},
|
||||
|
||||
findAnnotationPoint(trace) {
|
||||
const regex = /at(?: .* in)? ((?<path>[^:]+):(?<line>\d+))/;
|
||||
// Find first entry with non-zero line number in stack trace
|
||||
const items = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/g);
|
||||
const items = trace.match(new RegExp(regex, 'g'));
|
||||
if (Array.isArray(items)) {
|
||||
const result: { path: any; line: number }[] = [];
|
||||
for (const item of items) {
|
||||
const match = item.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
||||
const match = item.match(regex);
|
||||
const point = {
|
||||
path: match ? match.groups.path : '',
|
||||
line: match ? Number(match.groups.line) : 0,
|
||||
|
@ -146,7 +147,7 @@ const ResultsParser = {
|
|||
}
|
||||
}
|
||||
// If all entries have zero line number match fallback pattern
|
||||
const match = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
||||
const match = trace.match(regex);
|
||||
return {
|
||||
path: match ? match.groups.path : '',
|
||||
line: match ? Number(match.groups.line) : 0,
|
||||
|
|
Loading…
Reference in New Issue