diff options
author | w0rp <devw0rp@gmail.com> | 2021-03-01 20:11:10 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2021-03-01 20:11:10 +0000 |
commit | 9fe7b1fe6a23fb55e6d782293585d58193123f59 (patch) | |
tree | 0403deb70011aee7be08e586b10b5828cf69499e /test/test_eslint_executable_detection.vader | |
parent | 48fab99a0ab793e1b9607795c21659f12bd6947f (diff) | |
download | ale-9fe7b1fe6a23fb55e6d782293585d58193123f59.zip |
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they
can later be swapped out when running linters over projects is
supported, and also better support filename mapping for running linters
on other machines in future.
Diffstat (limited to 'test/test_eslint_executable_detection.vader')
-rw-r--r-- | test/test_eslint_executable_detection.vader | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/test/test_eslint_executable_detection.vader b/test/test_eslint_executable_detection.vader deleted file mode 100644 index 3fed63da..00000000 --- a/test/test_eslint_executable_detection.vader +++ /dev/null @@ -1,100 +0,0 @@ -Before: - let g:ale_javascript_eslint_executable = 'eslint_d' - - call ale#test#SetDirectory('/testplugin/test') - - runtime ale_linters/javascript/eslint.vim - -After: - let g:ale_javascript_eslint_executable = 'eslint' - let g:ale_javascript_eslint_use_global = 0 - - call ale#test#RestoreDirectory() - call ale#linter#Reset() - -Execute(create-react-app directories should be detected correctly): - call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js') - - AssertEqual - \ ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'), - \ ale#handlers#eslint#GetExecutable(bufnr('')) - -Execute(use-global should override create-react-app detection): - let g:ale_javascript_eslint_use_global = 1 - - call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js') - - AssertEqual - \ 'eslint_d', - \ ale#handlers#eslint#GetExecutable(bufnr('')) - -Execute(other app directories should be detected correctly): - call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js') - - AssertEqual - \ ale#path#Simplify(g:dir . '/eslint-test-files/node_modules/.bin/eslint'), - \ ale#handlers#eslint#GetExecutable(bufnr('')) - -Execute(use-global should override other app directories): - let g:ale_javascript_eslint_use_global = 1 - - call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js') - - AssertEqual - \ 'eslint_d', - \ ale#handlers#eslint#GetExecutable(bufnr('')) - -Execute(eslint_d should be detected correctly): - call ale#test#SetFilename('eslint-test-files/app-with-eslint-d/testfile.js') - - AssertEqual - \ ale#path#Simplify(g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'), - \ ale#handlers#eslint#GetExecutable(bufnr('')) - -Execute(eslint.js executables should be run with node on Windows): - call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js') - - " We have to execute the file with node. - if has('win32') - AssertEqual - \ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app')) - \ . ale#Escape('node.exe') . ' ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')) - \ . ' -f json --stdin --stdin-filename %s', - \ ale#handlers#eslint#GetCommand(bufnr('')) - else - AssertEqual - \ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app')) - \ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')) - \ . ' -f json --stdin --stdin-filename %s', - \ ale#handlers#eslint#GetCommand(bufnr('')) - endif - -Execute(eslint.js should be run from containing project with eslint): - call ale#test#SetFilename('eslint-test-files/react-app/subdir-with-package-json/testfile.js') - - " We have to execute the file with node. - if has('win32') - AssertEqual - \ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app')) - \ . ale#Escape('node.exe') . ' ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')) - \ . ' -f json --stdin --stdin-filename %s', - \ ale#handlers#eslint#GetCommand(bufnr('')) - else - AssertEqual - \ ale#path#CdString(ale#path#Simplify(g:dir . '/eslint-test-files/react-app')) - \ . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')) - \ . ' -f json --stdin --stdin-filename %s', - \ ale#handlers#eslint#GetCommand(bufnr('')) - endif - -Execute(eslint.js executables can be run outside project dir): - " Set filename above eslint-test-files (which contains node_modules) - call ale#test#SetFilename('testfile.js') - - " cd "..." not present, since project root not found (from node_modules) - AssertEqual - \ ale#Escape(ale#handlers#eslint#GetExecutable(bufnr(''))) - \ . ' -f json --stdin --stdin-filename %s', - \ ale#handlers#eslint#GetCommand(bufnr('')) |