diff options
author | w0rp <devw0rp@gmail.com> | 2017-03-29 00:21:27 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-03-29 00:21:27 +0100 |
commit | a4220b99a6f7a9184545e71f70bc280648dde586 (patch) | |
tree | eb63c7d6b677574c15a45ecaf8d7b748041f38f9 /test/test_eslint_executable_detection.vader | |
parent | 4b9b4e3338187d3bee37a11f3e7b3777533fa703 (diff) | |
download | ale-a4220b99a6f7a9184545e71f70bc280648dde586.zip |
Fix #421 Automatically detect create-react-app paths
Diffstat (limited to 'test/test_eslint_executable_detection.vader')
-rw-r--r-- | test/test_eslint_executable_detection.vader | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/test_eslint_executable_detection.vader b/test/test_eslint_executable_detection.vader new file mode 100644 index 00000000..e963ae1c --- /dev/null +++ b/test/test_eslint_executable_detection.vader @@ -0,0 +1,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 |