Before: silent! cd /testplugin/test/lsp let b:dir = getcwd() After: silent execute 'cd ' . fnameescape(b:dir) unlet! b:dir Execute(ale#lsp#message#Initialize() should return correct messages): AssertEqual \ [ \ 0, \ 'initialize', \ { \ 'processId': getpid(), \ 'rootUri': '/foo/bar', \ 'capabilities': {}, \ } \ ], \ ale#lsp#message#Initialize('/foo/bar') Execute(ale#lsp#message#Initialized() should return correct messages): AssertEqual [1, 'initialized'], ale#lsp#message#Initialized() Execute(ale#lsp#message#Shutdown() should return correct messages): AssertEqual [0, 'shutdown'], ale#lsp#message#Shutdown() Execute(ale#lsp#message#Exit() should return correct messages): AssertEqual [1, 'exit'], ale#lsp#message#Exit(), Execute(ale#lsp#message#DidOpen() should return correct messages): AssertEqual \ [ \ 1, \ 'textDocument/didOpen', \ { \ 'textDocument': { \ 'uri': '/foo/bar', \ 'languageId': 'typescript', \ 'version': 123, \ 'text': 'foobar', \ }, \ } \ ], \ ale#lsp#message#DidOpen('/foo/bar', 'typescript', 123, 'foobar') Execute(ale#lsp#message#DidChange() should return correct messages): AssertEqual \ [ \ 1, \ 'textDocument/didChange', \ { \ 'textDocument': { \ 'uri': '/foo/bar', \ 'version': 123, \ }, \ 'contentChanges': [{'text': 'foobar'}], \ } \ ], \ ale#lsp#message#DidChange('/foo/bar', 123, 'foobar') Execute(ale#lsp#message#DidSave() should return correct messages): AssertEqual \ [ \ 1, \ 'textDocument/didSave', \ { \ 'textDocument': { \ 'uri': '/foo/bar', \ }, \ } \ ], \ ale#lsp#message#DidSave('/foo/bar') Execute(ale#lsp#message#DidClose() should return correct messages): AssertEqual \ [ \ 1, \ 'textDocument/didClose', \ { \ 'textDocument': { \ 'uri': '/foo/bar', \ }, \ } \ ], \ ale#lsp#message#DidClose('/foo/bar') Execute(ale#lsp#tsserver_message#Open() should return correct messages): silent! noautocmd file foo.ts AssertEqual \ [ \ 1, \ 'ts@open', \ { \ 'file': b:dir . '/foo.ts', \ } \ ], \ ale#lsp#tsserver_message#Open(bufnr('')) Execute(ale#lsp#tsserver_message#Close() should return correct messages): silent! noautocmd file foo.ts AssertEqual \ [ \ 1, \ 'ts@close', \ { \ 'file': b:dir . '/foo.ts', \ } \ ], \ ale#lsp#tsserver_message#Close(bufnr('')) Given typescript(A TypeScript file with 3 lines): foo() bar() baz() Execute(ale#lsp#tsserver_message#Change() should return correct messages): silent! noautocmd file foo.ts AssertEqual \ [ \ 1, \ 'ts@change', \ { \ 'file': b:dir . '/foo.ts', \ 'line': 1, \ 'offset': 1, \ 'endLine': 1073741824, \ 'endOffset': 1, \ 'insertString': "foo()\nbar()\nbaz()", \ } \ ], \ ale#lsp#tsserver_message#Change(bufnr('')) Execute(ale#lsp#tsserver_message#Geterr() should return correct messages): silent! noautocmd file foo.ts AssertEqual \ [ \ 0, \ 'ts@geterr', \ { \ 'files': [b:dir . '/foo.ts'], \ } \ ], \ ale#lsp#tsserver_message#Geterr(bufnr(''))