fixers/xo: add tests
This commit is contained in:
parent
6bfcb9cdff
commit
4a6136c27e
3 changed files with 32 additions and 1 deletions
|
@ -14,10 +14,12 @@ endfunction
|
||||||
|
|
||||||
function! ale#fixers#xo#Fix(buffer) abort
|
function! ale#fixers#xo#Fix(buffer) abort
|
||||||
let l:executable = ale#fixers#xo#GetExecutable(a:buffer)
|
let l:executable = ale#fixers#xo#GetExecutable(a:buffer)
|
||||||
|
let l:options = ale#Var(a:buffer, 'javascript_xo_options')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||||
\ . ' --fix %t',
|
\ . ' --fix %t'
|
||||||
|
\ . ale#Pad(l:options),
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
0
test/eslint-test-files/react-app/node_modules/xo/cli.js
generated
vendored
Normal file
0
test/eslint-test-files/react-app/node_modules/xo/cli.js
generated
vendored
Normal file
29
test/fixers/test_xo_fixer_callback.vader
Normal file
29
test/fixers/test_xo_fixer_callback.vader
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpFixerTest('javascript', 'xo')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
|
Execute(The xo callback should return the correct default values):
|
||||||
|
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||||
|
|
||||||
|
AssertFixer
|
||||||
|
\ {
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js'))
|
||||||
|
\ . ' --fix %t',
|
||||||
|
\ }
|
||||||
|
|
||||||
|
Execute(The xo callback should include custom xo options):
|
||||||
|
let g:ale_javascript_xo_options = '--space'
|
||||||
|
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||||
|
|
||||||
|
AssertFixer
|
||||||
|
\ {
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||||
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js'))
|
||||||
|
\ . ' --fix %t'
|
||||||
|
\ . ' --space',
|
||||||
|
\ }
|
Reference in a new issue