Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for Red/Green when specs pass/fail

  • Loading branch information...
commit 9d651daf08895b9666db25feccea7f4bc81ea908 1 parent 36ae608
@claco claco authored
Showing with 26 additions and 7 deletions.
  1. +26 −7 autoload/jasmine.vim
View
33 autoload/jasmine.vim
@@ -72,19 +72,38 @@ endfunction
function jasmine#run_tests()
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
-function jasmine#redbar()
- hi RedBar ctermfg=white ctermbg=red guibg=red
+function jasmine#redbar(message)
+ let message = " ".a:message
+ hi RedBar ctermfg=white ctermbg=red guifg=white guibg=red
echohl RedBar
- echon repeat(" ",&columns - 1)
+ echon message repeat(" ", &columns - strlen(message) - 1)
echohl
endfunction
-function jasmine#greenbar()
- hi GreenBar ctermfg=white ctermbg=green guibg=green
+function jasmine#greenbar(message)
+ let message = " ".a:message
+ hi GreenBar ctermfg=black ctermbg=green guifg=black guibg=green
echohl GreenBar
- echon repeat(" ",&columns - 1)
+ echon message repeat(" ", &columns - strlen(message) - 1)
echohl
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.