This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export function filterExpected(
22
22
// 2. Required TS error: 'TS2000: message text.'
23
23
// Need triple escapes because the expected diagnostics that we're matching
24
24
// here are regexes, too.
25
- const ERROR_RE = / ^ (?: \\ \( ( \d * ) , ( \d * ) \\ \) .* ) ? T S ( \d + ) : ( .* ) / ;
25
+ const ERROR_RE = / ^ (?: \\ \( ( \d * ) , ( \d * ) \\ \) .* ) ? T S ( - ? \d + ) : ( .* ) / ;
26
26
const incorrectErrors =
27
27
bazelOpts . expectedDiagnostics . filter ( e => ! e . match ( ERROR_RE ) ) ;
28
28
if ( incorrectErrors . length ) {
@@ -52,7 +52,7 @@ export function filterExpected(
52
52
53
53
const expectedDiags : ExpectedDiagnostics [ ] =
54
54
bazelOpts . expectedDiagnostics . map ( expected => {
55
- const m = expected . match ( / ^ (?: \\ \( ( \d * ) , ( \d * ) \\ \) .* ) ? T S ( \d + ) : ( .* ) $ / ) ;
55
+ const m = expected . match ( / ^ (?: \\ \( ( \d * ) , ( \d * ) \\ \) .* ) ? T S ( - ? \d + ) : ( .* ) $ / ) ;
56
56
if ( ! m ) {
57
57
throw new Error (
58
58
'Incorrect expected error, did you forget character escapes in ' +
Original file line number Diff line number Diff line change @@ -58,5 +58,10 @@ describe('diagnostics', () => {
58
58
'Incorrect expected error, did you forget character escapes in ' +
59
59
'TS1234:unescaped \n newline' ) ;
60
60
} ) ;
61
+
62
+ it ( 'handle negative diagnostic codes' , ( ) => {
63
+ expect ( filter ( [ 'TS-999:custom error' ] , [ diag ( - 999 , 'custom error' ) ] ) )
64
+ . toEqual ( [ ] ) ;
65
+ } ) ;
61
66
} ) ;
62
67
} ) ;
You can’t perform that action at this time.
0 commit comments