fallback to elm if elm-tests isn’t available

This commit is contained in:
Aryeh Leib Taurog 2019-01-04 08:57:14 +02:00
parent 4a11a6337e
commit 1f21eb0c42
5 changed files with 14 additions and 1 deletions

View file

@ -209,7 +209,11 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
if l:is_test && l:is_v19 if l:is_test && l:is_v19
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm-test']) return ale#node#FindExecutable(
\ a:buffer,
\ 'elm_make',
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
\ )
else else
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
endif endif

View file

@ -24,6 +24,15 @@ Execute(should get elm-test executable for test code with elm >= 0.19):
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && ' \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp')) . ' && '
\ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t' \ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
Execute(should fallback to elm executable with elm >= 0.19):
call ale#test#SetFilename('../elm-test-files/newapp-notests/tests/TestMain.elm')
let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/newapp-notests/node_modules/.bin/elm')
AssertLinter g:executable,
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/newapp-notests')) . ' && '
\ . ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
Execute(should get plain elm executable for test code with elm < 0.19): Execute(should get plain elm executable for test code with elm < 0.19):
call ale#test#SetFilename('../elm-test-files/oldapp/tests/TestSuite.elm') call ale#test#SetFilename('../elm-test-files/oldapp/tests/TestSuite.elm')

View file