diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/linter/test_javascript_deno_lsp.vader | 79 | ||||
-rw-r--r-- | test/test-files/javascript_deno/custom_import_map.json | 3 | ||||
-rw-r--r-- | test/test-files/javascript_deno/import_map.json | 3 | ||||
-rw-r--r-- | test/test-files/javascript_deno/main.js | 1 | ||||
-rw-r--r-- | test/test-files/javascript_deno/tsconfig.json | 16 |
5 files changed, 102 insertions, 0 deletions
diff --git a/test/linter/test_javascript_deno_lsp.vader b/test/linter/test_javascript_deno_lsp.vader new file mode 100644 index 00000000..965ce600 --- /dev/null +++ b/test/linter/test_javascript_deno_lsp.vader @@ -0,0 +1,79 @@ +Before: + let g:ale_deno_importMap = 'import_map.json' + let g:ale_deno_unstable = 0 + let g:ale_deno_executable = 'deno' + let g:ale_deno_lsp_project_root = '' + + runtime autoload/ale/handlers/deno.vim + call ale#assert#SetUpLinterTest('javascript', 'deno') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should set deno lsp for JavaScript projects using stable Deno API): + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': '' + \} + +Execute(Should set deno lsp using unstable Deno API if enabled by user): + let g:ale_deno_unstable = 1 + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': '' + \} + +Execute(Should set the default importMap filepath): + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap): + let g:ale_deno_importMap = 'custom_import_map.json' + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/custom_import_map.json') + \} + +Execute(Should set the importMap filepath from user defined importMap with unstable API): + let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_unstable = 1 + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPOptions { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:true, + \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/javascript_deno/custom_import_map.json') + \} + +Execute(Should find project root containing tsconfig.json): + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPLanguage 'javascript' + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/javascript_deno') + +Execute(Should use user-specified project root): + let g:ale_deno_lsp_project_root = '/' + + call ale#test#SetFilename('../test-files/javascript_deno/main.js') + + AssertLSPLanguage 'javascript' + AssertLSPProject '/' + +Execute(Check Deno LSP command): + AssertLinter 'deno', ale#Escape('deno') . ' lsp' diff --git a/test/test-files/javascript_deno/custom_import_map.json b/test/test-files/javascript_deno/custom_import_map.json new file mode 100644 index 00000000..9f5a19a1 --- /dev/null +++ b/test/test-files/javascript_deno/custom_import_map.json @@ -0,0 +1,3 @@ +{ + "imports": {} +} diff --git a/test/test-files/javascript_deno/import_map.json b/test/test-files/javascript_deno/import_map.json new file mode 100644 index 00000000..9f5a19a1 --- /dev/null +++ b/test/test-files/javascript_deno/import_map.json @@ -0,0 +1,3 @@ +{ + "imports": {} +} diff --git a/test/test-files/javascript_deno/main.js b/test/test-files/javascript_deno/main.js new file mode 100644 index 00000000..accefceb --- /dev/null +++ b/test/test-files/javascript_deno/main.js @@ -0,0 +1 @@ +console.log("Hello World"); diff --git a/test/test-files/javascript_deno/tsconfig.json b/test/test-files/javascript_deno/tsconfig.json new file mode 100644 index 00000000..152b034e --- /dev/null +++ b/test/test-files/javascript_deno/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "allowJs": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "isolatedModules": true, + "jsx": "react", + "lib": ["deno.window"], + "module": "esnext", + "strict": true, + "target": "esnext", + "useDefineForClassFields": true + }, + "includes": ["main.js"] +} |