summaryrefslogtreecommitdiff
path: root/test/test_eslint_executable_detection.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_eslint_executable_detection.vader')
-rw-r--r--test/test_eslint_executable_detection.vader35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/test_eslint_executable_detection.vader b/test/test_eslint_executable_detection.vader
index 64383dcb..3fed63da 100644
--- a/test/test_eslint_executable_detection.vader
+++ b/test/test_eslint_executable_detection.vader
@@ -57,13 +57,44 @@ Execute(eslint.js executables should be run with node on Windows):
" We have to execute the file with node.
if has('win32')
AssertEqual
- \ ale#Escape('node.exe') . ' '
+ \ 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#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ 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(''))