Add exact file match test to TSServer response handler

This commit is contained in:
Horacio Sanson 2019-05-23 10:19:07 +09:00
parent 2f13c2d263
commit 85b3a4a5c6
1 changed files with 58 additions and 0 deletions

View File

@ -92,6 +92,35 @@ Execute(tsserver syntax error responses should be handled correctly):
\ ],
\ ale#test#GetLoclistWithoutModule()
" Syntax errors on the project root should not populate the LocList.
call ale#lsp_linter#HandleLSPResponse(1, {
\ 'seq': 0,
\ 'type': 'event',
\ 'event': 'syntaxDiag',
\ 'body': {
\ 'file': g:dir,
\ 'diagnostics':[
\ {
\ 'start': {
\ 'line':2,
\ 'offset':14,
\ },
\ 'end': {
\ 'line':2,
\ 'offset':15,
\ },
\ 'text': ''','' expected.',
\ "code":1005
\ },
\ ],
\ },
\})
AssertEqual
\ [
\ ],
\ ale#test#GetLoclistWithoutModule()
Execute(tsserver semantic error responses should be handled correctly):
runtime ale_linters/typescript/tsserver.vim
call ale#test#SetFilename('filename.ts')
@ -165,6 +194,35 @@ Execute(tsserver semantic error responses should be handled correctly):
\ ],
\ ale#test#GetLoclistWithoutModule()
" Semantic errors on the project root should not populate the LocList.
call ale#lsp_linter#HandleLSPResponse(1, {
\ 'seq': 0,
\ 'type': 'event',
\ 'event': 'semanticDiag',
\ 'body': {
\ 'file': g:dir,
\ 'diagnostics':[
\ {
\ 'start': {
\ 'line':2,
\ 'offset':14,
\ },
\ 'end': {
\ 'line':2,
\ 'offset':15,
\ },
\ 'text': 'Some semantic error',
\ "code":1005
\ },
\ ],
\ },
\})
AssertEqual
\ [
\ ],
\ ale#test#GetLoclistWithoutModule()
Execute(tsserver errors should mark tsserver no longer active):
let b:ale_linters = ['tsserver']
runtime ale_linters/typescript/tsserver.vim