-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TypeScript error line/column (#125)
* Fix TypeScript error line/column * Adopt official pattern from VS Code * Minor cleanup * Add tests for tsc problem matcher Co-authored-by: Lukas Spieß <lumaxis@github.com>
- Loading branch information
Showing
3 changed files
with
50 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
describe('problem matcher tests', () => { | ||
it('tsc: matches TypeScript "pretty" error message', () => { | ||
const [ | ||
{ | ||
pattern: [{regexp}] | ||
} | ||
] = require('../.github/tsc.json').problemMatcher; | ||
const exampleErrorMessage = | ||
"lib/index.js:23:42 - error TS2345: Argument of type 'A' is not assignable to parameter of type 'B'."; | ||
|
||
const match = exampleErrorMessage.match(new RegExp(regexp)); | ||
expect(match).not.toBeNull(); | ||
expect(match![1]).toEqual('lib/index.js'); | ||
expect(match![2]).toEqual('23'); | ||
expect(match![3]).toEqual('42'); | ||
expect(match![4]).toEqual('error'); | ||
expect(match![5]).toEqual('2345'); | ||
expect(match![6]).toEqual( | ||
"Argument of type 'A' is not assignable to parameter of type 'B'." | ||
); | ||
}); | ||
|
||
it('tsc: matches TypeScript error message from log file', () => { | ||
const [ | ||
{ | ||
pattern: [{regexp}] | ||
} | ||
] = require('../.github/tsc.json').problemMatcher; | ||
const exampleErrorMessage = | ||
"lib/index.js(23,42): error TS2345: Argument of type 'A' is not assignable to parameter of type 'B'."; | ||
|
||
const match = exampleErrorMessage.match(new RegExp(regexp)); | ||
expect(match).not.toBeNull(); | ||
expect(match![1]).toEqual('lib/index.js'); | ||
expect(match![2]).toEqual('23'); | ||
expect(match![3]).toEqual('42'); | ||
expect(match![4]).toEqual('error'); | ||
expect(match![5]).toEqual('2345'); | ||
expect(match![6]).toEqual( | ||
"Argument of type 'A' is not assignable to parameter of type 'B'." | ||
); | ||
}); | ||
}); |
This comment has been minimized.
Sorry, something went wrong.
cokymanNov 30, 2024
This comment has been minimized.
Sorry, something went wrong.
cokymanNov 30, 2024