]> git.madduck.net Git - etc/vim.git/blobdiff - .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
diff --git a/.vim/bundle/ale/test/linter/test_eslint.vader b/.vim/bundle/ale/test/linter/test_eslint.vader
new file mode 100644 (file)
index 0000000..6c05fc6
--- /dev/null
@@ -0,0 +1,87 @@
+Before:
+  call ale#assert#SetUpLinterTest('javascript', 'eslint')
+  runtime autoload/ale/handlers/eslint.vim
+
+  let b:args = ' -f json --stdin --stdin-filename %s'
+
+After:
+  unlet! b:args
+  unlet! b:executable
+
+  call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+  AssertLinterCwd ''
+  AssertLinter 'eslint', ale#Escape('eslint') . b:args
+
+Execute(create-react-app directories should be detected correctly):
+  call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
+  AssertLinter b:executable,
+  \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
+  \ . ale#Escape(b:executable) . b:args
+
+Execute(use-global should override create-react-app detection):
+  call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
+
+  let g:ale_javascript_eslint_use_global = 1
+  let g:ale_javascript_eslint_executable = 'eslint_d'
+
+  let b:executable = 'eslint_d'
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
+  AssertLinter b:executable, ale#Escape(b:executable) . b:args
+
+Execute(other app directories should be detected correctly):
+  call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
+  AssertLinter b:executable, ale#Escape(b:executable) . b:args
+
+Execute(use-global should override other app directories):
+  call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
+
+  let g:ale_javascript_eslint_use_global = 1
+  let g:ale_javascript_eslint_executable = 'eslint_d'
+
+  let b:executable = 'eslint_d'
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
+  AssertLinter b:executable, ale#Escape(b:executable) . b:args
+
+Execute(eslint.js executables should be run with node on Windows):
+  call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
+  AssertLinter b:executable,
+  \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
+  \ . ale#Escape(b:executable) . b:args
+
+Execute(eslint.js should be run from a containing project with node_modules):
+  call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
+  AssertLinter b:executable,
+  \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
+  \ . ale#Escape(b:executable) . b:args
+
+Execute(eslint.js should be run from a containing project with .yarn/sdks):
+  call ale#test#SetFilename('../test-files/eslint/yarn2-app/subdir/testfile.js')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app')
+  AssertLinter b:executable,
+  \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
+  \ . ale#Escape(b:executable) . b:args
+
+Execute(astro directories should be detected correctly):
+  call ale#test#SetFilename('../test-files/eslint/astro-app/src/pages/index.astro')
+
+  let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/astro-app/node_modules/eslint/bin/eslint.js')
+  AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/astro-app')
+  AssertLinter b:executable,
+  \ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
+  \ . ale#Escape(b:executable) . b:args