summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArnold Chand <creativenull@outlook.com>2021-07-25 00:39:56 -0400
committerGitHub <noreply@github.com>2021-07-25 13:39:56 +0900
commit8c591996a83d623fb158fe090acbd89dabbfaf06 (patch)
tree048374b84da988f9a31297538f978a3957bb96fe /test
parent7d8fb2ba1716a744446b811fc278ecf30d4eb771 (diff)
downloadale-8c591996a83d623fb158fe090acbd89dabbfaf06.zip
Add importMap option to deno Initialization Options (#3827)
* feat(deno): move init options to handlers * feat(deno): add deno lsp support for js files * feat(deno): use default map option * feat(docs): add deno import map option * feat(deno): add tests for importMap option * fix(deno): use full path in importMap * feat(deno): remove deno as linter for js, separate PR * fix(deno): test for executable * fix(deno-test): include filename to simplify function
Diffstat (limited to 'test')
-rw-r--r--test/linter/test_typescript_deno_lsp.vader40
-rw-r--r--test/test-files/typescript/custom_import_map.json0
-rw-r--r--test/test-files/typescript/import_map.json0
-rw-r--r--test/test_deno_executable_detection.vader3
4 files changed, 40 insertions, 3 deletions
diff --git a/test/linter/test_typescript_deno_lsp.vader b/test/linter/test_typescript_deno_lsp.vader
index 88b2e036..944f6a0a 100644
--- a/test/linter/test_typescript_deno_lsp.vader
+++ b/test/linter/test_typescript_deno_lsp.vader
@@ -1,4 +1,5 @@
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 = ''
@@ -13,7 +14,8 @@ Execute(Should set deno lsp for TypeScript projects using stable Deno API):
AssertLSPOptions {
\ 'enable': v:true,
\ 'lint': v:true,
- \ 'unstable': v:false
+ \ 'unstable': v:false,
+ \ 'importMap': ''
\}
Execute(Should set deno lsp using unstable Deno API if enabled by user):
@@ -22,7 +24,41 @@ Execute(Should set deno lsp using unstable Deno API if enabled by user):
AssertLSPOptions {
\ 'enable': v:true,
\ 'lint': v:true,
- \ 'unstable': v:true
+ \ 'unstable': v:true,
+ \ 'importMap': ''
+ \}
+
+Execute(Should set the default importMap filepath):
+ call ale#test#SetFilename('../test-files/typescript/test.ts')
+
+ AssertLSPOptions {
+ \ 'enable': v:true,
+ \ 'lint': v:true,
+ \ 'unstable': v:false,
+ \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/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/typescript/test.ts')
+
+ AssertLSPOptions {
+ \ 'enable': v:true,
+ \ 'lint': v:true,
+ \ 'unstable': v:false,
+ \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/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/typescript/test.ts')
+
+ AssertLSPOptions {
+ \ 'enable': v:true,
+ \ 'lint': v:true,
+ \ 'unstable': v:true,
+ \ 'importMap': ale#path#Simplify(g:dir . '/../test-files/typescript/custom_import_map.json')
\}
Execute(Should find project root containing tsconfig.json):
diff --git a/test/test-files/typescript/custom_import_map.json b/test/test-files/typescript/custom_import_map.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/typescript/custom_import_map.json
diff --git a/test/test-files/typescript/import_map.json b/test/test-files/typescript/import_map.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/typescript/import_map.json
diff --git a/test/test_deno_executable_detection.vader b/test/test_deno_executable_detection.vader
index edd408b1..87690bfe 100644
--- a/test/test_deno_executable_detection.vader
+++ b/test/test_deno_executable_detection.vader
@@ -1,8 +1,9 @@
Before:
+ Save g:ale_deno_executable
runtime autoload/ale/handlers/deno.vim
After:
- unlet! g:ale_deno_executable
+ unlet! b:ale_deno_executable
call ale#linter#Reset()