summaryrefslogtreecommitdiff
path: root/test/test_eslint_executable_detection.vader
blob: e963ae1c257539b99ab4fa69448e01a90d45c698 (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
Before:
  let g:ale_javascript_eslint_executable = 'eslint_d'

  silent! cd /testplugin/test
  let g:dir = getcwd()

  runtime ale_linters/javascript/eslint.vim

After:
  let g:ale_javascript_eslint_executable = 'eslint'
  let g:ale_javascript_eslint_use_global = 0

  silent execute 'cd ' . g:dir
  unlet! g:dir

  call ale#linter#Reset()

Execute(create-react-app directories should be detected correctly):
  new eslint-test-files/react-app/subdir/testfile.js

  AssertEqual
  \ g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js',
  \ ale_linters#javascript#eslint#GetExecutable(bufnr(''))

  :q

Execute(use-global should override create-react-app detection):
  let g:ale_javascript_eslint_use_global = 1

  new eslint-test-files/react-app/subdir/testfile.js

  AssertEqual
  \ 'eslint_d',
  \ ale_linters#javascript#eslint#GetExecutable(bufnr(''))

  :q

Execute(other app directories should be detected correctly):
  new eslint-test-files/other-app/subdir/testfile.js

  AssertEqual
  \ g:dir . '/eslint-test-files/node_modules/.bin/eslint',
  \ ale_linters#javascript#eslint#GetExecutable(bufnr(''))

  :q

Execute(use-global should override other app directories):
  let g:ale_javascript_eslint_use_global = 1

  new eslint-test-files/other-app/subdir/testfile.js

  AssertEqual
  \ 'eslint_d',
  \ ale_linters#javascript#eslint#GetExecutable(bufnr(''))

  :q