Skip to content

Instantly share code, notes, and snippets.

@GiuseppeMP
Forked from dansomething/vim-test.vim
Created June 13, 2022 20:04
Show Gist options
  • Save GiuseppeMP/2f75256774cf98a5c1cb769fb9cfdd7d to your computer and use it in GitHub Desktop.
Save GiuseppeMP/2f75256774cf98a5c1cb769fb9cfdd7d to your computer and use it in GitHub Desktop.
vim-test with vim-dispatch strategy for a multi-module Maven, Java and Groovy project using Spock
" https://github.com/janko-m/vim-test
"------------------------------------
let test#strategy = "dispatch"
let test#enabled_runners = ["groovy#maventest", "java#maventest"]
let g:test#groovy#maventest#defaultoptions = '-DfailIfNoTests=true -Dmaven.test.redirectTestOutputToFile=false'
let g:test#groovy#maventest#options = g:test#groovy#maventest#defaultoptions . ' -DargLine="' . $JAVA_OPTS . '"'
let g:test#groovy#maventest#executable = 'mw test'
function! TestCoverage()
unlet! g:test#last_command g:test#last_position g:test#last_strategy
let l:oldOptions = g:test#groovy#maventest#options
let g:test#groovy#maventest#options = g:test#groovy#maventest#defaultoptions
:TestNearest jacoco:report -Pjacoco
let g:test#groovy#maventest#options = l:oldOptions
endfunction
" https://github.com/tpope/vim-dispatch
"--------------------------------------
let g:dispatch_compilers = {}
" https://github.com/dansomething/mdub
let g:dispatch_compilers['mw'] = 'maven3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment