Added support for Red/Green when specs pass/fail
This commit is contained in:
parent
36ae608e7d
commit
9d651daf08
@ -72,19 +72,38 @@ endfunction
|
|||||||
|
|
||||||
function jasmine#run_tests()
|
function jasmine#run_tests()
|
||||||
let b:jasmine_root = jasmine#find_root()
|
let b:jasmine_root = jasmine#find_root()
|
||||||
execute "make --rakefile=\"".b:jasmine_rakefile."\" jasmine:ci"
|
|
||||||
|
echon "Running Jasmine tests..."
|
||||||
|
silent! let result = system("rake --rakefile=\"".b:jasmine_rakefile."\" jasmine:ci BACKGROUND=true")
|
||||||
|
redraw
|
||||||
|
|
||||||
|
let lines = split(result, "\n")
|
||||||
|
for line in lines
|
||||||
|
if line =~ '\d\+ examples, \(\d\+\) failure'
|
||||||
|
if line =~ ', 0 failure'
|
||||||
|
call jasmine#greenbar(line)
|
||||||
|
else
|
||||||
|
call jasmine#redbar(line)
|
||||||
|
endif
|
||||||
|
|
||||||
|
redraw
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function jasmine#redbar()
|
function jasmine#redbar(message)
|
||||||
hi RedBar ctermfg=white ctermbg=red guibg=red
|
let message = " ".a:message
|
||||||
|
hi RedBar ctermfg=white ctermbg=red guifg=white guibg=red
|
||||||
echohl RedBar
|
echohl RedBar
|
||||||
echon repeat(" ",&columns - 1)
|
echon message repeat(" ", &columns - strlen(message) - 1)
|
||||||
echohl
|
echohl
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function jasmine#greenbar()
|
function jasmine#greenbar(message)
|
||||||
hi GreenBar ctermfg=white ctermbg=green guibg=green
|
let message = " ".a:message
|
||||||
|
hi GreenBar ctermfg=black ctermbg=green guifg=black guibg=green
|
||||||
echohl GreenBar
|
echohl GreenBar
|
||||||
echon repeat(" ",&columns - 1)
|
echon message repeat(" ", &columns - strlen(message) - 1)
|
||||||
echohl
|
echohl
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user