• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

donatj / loggre / 27237678187

06 Jun 2026 11:51PM UTC coverage: 26.892% (-2.1%) from 29.032%
27237678187

push

github

donatj
Fix invalid date handling

45 of 125 branches covered (36.0%)

Branch coverage included in aggregate %.

0 of 5 new or added lines in 1 file covered. (0.0%)

93 existing lines in 1 file now uncovered.

90 of 377 relevant lines covered (23.87%)

21.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/logtypes/php-error.ts
1
import { LogEntry, LogType } from "./Logs";
2

3
export class PhpErrorLog implements LogType {
×
4

5
        looksLikeLogLine(line: string): boolean {
6
                return line[0] === '[';
×
7
        }
8

9
        parseLogLine(line: string): LogEntry {
10
                return new PhpErrorLogEntry(line);
×
11
        }
12

13
}
14

15
export class PhpErrorLogEntry implements LogEntry {
×
16

17
        constructor(public readonly log: string) {
×
18
                this.log = this.log.trim();
×
19
        }
20

21
        getRawEntry(): string {
22
                return this.log;
×
23
        }
24

25
        getMessage(): string {
26
                const match = this.log.match(/(?<=] ).*/);
×
27
                return match ? match[0] : ""; // @todo Throw an error if no match found?
×
28
        }
29

30
        getDate(): Date {
31
                const match = this.log.match(/\[(.*?)\]/);
×
32
                if (!match) {
×
NEW
33
                        throw new Error("Log entry does not contain a valid date.");
×
34
                }
35

NEW
36
                const date = new Date(match[1]);
×
NEW
37
                if (isNaN(date.getTime())) {
×
NEW
38
                        throw new Error("Log entry does not contain a valid date format: " + match[1]);
×
39
                }
40

NEW
41
                return date;
×
42
        }
43

44
        hasDetails(): boolean {
45
                return this.log.includes("\n");
×
46
        }
47

48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc