summaryrefslogtreecommitdiff
path: root/test/linter/test_javascript_deno_lsp.vader
blob: c48d52cc243e77622dbee60a7ced8e60daaab2bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Before:
  Save g:ale_deno_import_map
  Save g:ale_deno_unstable
  Save g:ale_deno_executable
  Save g:ale_deno_lsp_project_root

  let g:ale_deno_import_map = '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_import_map = '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_import_map = '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'