Coder Social home page Coder Social logo

jasmine.vim's Introduction

Vim Plugin for Jasmine javascript testing

This is my first attempt at a vim plugin bundle. I’m sure there are dragons in here. :-)

Installation

I’m currently using Pathogen and am assuming you are too. That means you should be able to do:

git clone git://github.com/claco/jasmine.vim.git bundle/jasmine

inside of your ~/.vim directory. If you’re using submodules to track your bundles:

git submodule add git://github.com/claco/jasmine.vim.git bundle/jasmine
git submodule init
git submodule update

What it does

This plugin is pretty basic right now. It currently:

  • Sets *Spec.js and *SpecHelper.js files to filetype=jasmine.javascript syntax=jasmine
  • Sets *Spec.coffee and *SpecHelper.coffee files to filetype=jasmine.coffee syntax=jasmine
  • Applies basic syntax highlighting for jasmine keywords in addition to normal javascript syntax
  • Loads snippets for the jasmine filetype for:
    • desc: description block with before..it..expect
    • before: beforeEach block
    • after: afterEach block
    • it: it…expect block
    • helper: beforeEach block and addMatcher/matcher blocks for SpecHelper.js
    • matcher: matcher block for SpecHelper.js
    • expect: expect..to line
    • spy: spyOn method
  • Uses templates for new jasmine buffers
  • Runs all specs in jasmine:ci and shows Red/Green bar

You can disable templating by setting g:jasmine_use_templates=""

By default, the plugin assumes the templates are in bundle/jasmine/template and the snippets are in bundle/jasmine/snippets. You can override those by setting g:jasmine_snippets_directory and g:jasmine_templates_directory in your vimrc

Running Specs

I’m slowly working on interactive spec running support. Currently, the Jasmine() command is provided for jasmine buffers. When invoked, it searches the current/parent directories of that buffer for the nearest Rakefile and invokes rake jasmine:ci to run all specs.
Jasmine buffers now have compiler set to the jasmine compiler and leader-m is mapped to run :Jasmine → jasmine#run_tests → :make → rake jasmine:ci

If the specs fail, the bottom buffer status turns Red. If all specs pass, the status turns Green.

I plan on adding quickfix error support.

TODO

  • Add commands/functions to run a spec, a spec file
  • Add QuickFix error buffer support
  • docs help file

jasmine.vim's People

Contributors

claco avatar creasty avatar johnbintz avatar jvortmann avatar kevicency avatar luan avatar mharju avatar rosenfeld avatar superstructor avatar venables avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jasmine.vim's Issues

Triggering from a spec folder

I don't use files that end in spec.js, instead I have a folder named 'spec'.

I tried modifying the autcmd lines, but it doesn't seem like it reads the full file path. If it did, this would be my suggestion:

autocmd BufNewFile,BufRead,BufWritePost *[Ss]pec*js,*SpecHelper*js set filetype=jasmine.javascript syntax=jasmine.javascript
autocmd BufNewFile,BufRead,BufWritePost *[Ss]pec*coffee,*SpecHelper*coffee set filetype=jasmine.coffee syntax=jasmine.coffee

Grunt + karma support

At the moment this plugin only supports jasmine tests in a rails application and actively searches for the jasmine rake task.

It would be nice if support for grunt and karma would be implemented.

I would help you with this but I'm still learning the basics about VimScript atm..

Add pathogen requirement to README

This plugin requires pathogen to be installed because of pathogen#split(&rtp). The README reads like pathogen is used in the example to install the plugin but is not a hard requirement. If you agree I can submit a PR to adjust the README.

I use vundle to manage plugins and so this plugin does not work for me :(

Snippets not loaded on windows

The current version hard coded the load path for the bundle/jasmine/snippets

This needs to cycle through runtimepaths and locate the path.

Now using pathogen#split and runtimepath to fund bundle/jasmine

There is a related SnipMate bug on Windows preventing the vimfiles/snippets directory from loading, which is also killing javascript snippets in some cases: http://code.google.com/p/snipmate/issues/detail?id=137#c0

snippets are not working

Hi @claco
i tried using your plugin again and couldn't get it working I am not sure if you are familiar with https://github.com/carlhuda/janus

steps i followed installed it by adding this to Rakefile using

added templates to Dirs in Rakefile I checked templates and snippets do have jasmine.vim code in them...
added jasmine plugin

~/.vim/Rakefile
  vim_plugin_task "jasmin",           "git://github.com/claco/jasmine.vim.git"

~/.vimrc.local
  let g:jasmine_snippets_directory='~/.vim/snippets'
  let g:jasmine_templates='~/.vim/templates'

Syntax Highlighting Does Not Work Inside Function

I use MacVim, and the plugin works OK except for syntax highlighting.

Outside a function (at the top, for example), the keywords are highlighted, but within the function they lose their highlighting.

I tried editing the syntax/jasmine.vim file but I didn't get anywhere.

Getting an error when loading a spec in vim

Error detected while processing function    jasmine#load_snippets..jasmine#snippets_directory..jasmine#directory:
line    9:
E121: Undefined variable: g:jasmine_directory
E15: Invalid expression: g:jasmine_directory

This is on a fresh Jasmine gem install (for Rails). I'm no Vim master so I'm a bit stuck on how to debug this. Any pointers would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.