]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_eslint.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / linter / test_eslint.vader
1 Before:
2   call ale#assert#SetUpLinterTest('javascript', 'eslint')
3   runtime autoload/ale/handlers/eslint.vim
4
5   let b:args = ' -f json --stdin --stdin-filename %s'
6
7 After:
8   unlet! b:args
9   unlet! b:executable
10
11   call ale#assert#TearDownLinterTest()
12
13 Execute(The default command should be correct):
14   AssertLinterCwd ''
15   AssertLinter 'eslint', ale#Escape('eslint') . b:args
16
17 Execute(create-react-app directories should be detected correctly):
18   call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
19
20   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
21   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
22   AssertLinter b:executable,
23   \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
24   \ . ale#Escape(b:executable) . b:args
25
26 Execute(use-global should override create-react-app detection):
27   call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
28
29   let g:ale_javascript_eslint_use_global = 1
30   let g:ale_javascript_eslint_executable = 'eslint_d'
31
32   let b:executable = 'eslint_d'
33   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
34   AssertLinter b:executable, ale#Escape(b:executable) . b:args
35
36 Execute(other app directories should be detected correctly):
37   call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
38
39   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint')
40   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
41   AssertLinter b:executable, ale#Escape(b:executable) . b:args
42
43 Execute(use-global should override other app directories):
44   call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
45
46   let g:ale_javascript_eslint_use_global = 1
47   let g:ale_javascript_eslint_executable = 'eslint_d'
48
49   let b:executable = 'eslint_d'
50   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
51   AssertLinter b:executable, ale#Escape(b:executable) . b:args
52
53 Execute(eslint.js executables should be run with node on Windows):
54   call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
55
56   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
57   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
58   AssertLinter b:executable,
59   \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
60   \ . ale#Escape(b:executable) . b:args
61
62 Execute(eslint.js should be run from a containing project with node_modules):
63   call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js')
64
65   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
66   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
67   AssertLinter b:executable,
68   \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
69   \ . ale#Escape(b:executable) . b:args
70
71 Execute(eslint.js should be run from a containing project with .yarn/sdks):
72   call ale#test#SetFilename('../test-files/eslint/yarn2-app/subdir/testfile.js')
73
74   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js')
75   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app')
76   AssertLinter b:executable,
77   \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
78   \ . ale#Escape(b:executable) . b:args
79
80 Execute(astro directories should be detected correctly):
81   call ale#test#SetFilename('../test-files/eslint/astro-app/src/pages/index.astro')
82
83   let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/astro-app/node_modules/eslint/bin/eslint.js')
84   AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/astro-app')
85   AssertLinter b:executable,
86   \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
87   \ . ale#Escape(b:executable) . b:args