Testing Meteor in Vim?

I’m making the big switch to Vim (Neovim to be precise), and I love it! But now I’m trying to figure out the best way to integrate testing (specifically of my Meteor app) into my setup and getting stuck. Before I bang my head against the wall too much trying to figure this out, I figured I’d ask our wonderful community

Vim users: how do you deal with testing in Meteor? Is there anything more sophisticated to be done than running meteor test in a separate terminal window?

I had a nice setup with VS Code where I could see test results right in my .spec.js file, not sure if that’s possible with Vim. I was using Mocha/Chai (and Jest before that) but honestly I only have a few tests so far so I could always port them if need be…

Thanks for any insight you can provide! :man_technologist:

1 Like

Not an answer to your question, but have you tried the Vetur VsCodeVim extension so you can use Vim in VS Code? Works nicely for me.

Looks like Vetur is for Vue. I assume you meant VSCodeVim. I started my transition from VS Code to Vim in January with that extension, which definitely served me well. But over time I kept running into rough edges (e.g. unpredictable undo), and the more I learned about Vim the more I realized I wasn’t quite getting the whole package with an emulator. vscode-neovim improved on some of those shortcomings, but had its own drawbacks, and I could never get it working with plugins and such (being on Windows probably didn’t help). So a couple weeks ago I decided to switch to Neovim in the terminal and see how it went. It was a rough few days, and many hours of tinkering with init.vim, plugins, etc., but this week I started to hit my stride, shipping features and squashing bugs, and found that I didn’t miss much about VS Code. I wasn’t expecting it to be this damn fun, either. I’m starting to see why people get spoiled by it.

Yeah sorry, of course I meant VSCodeVim! Vim/Vue - I searched for the wrong extension.

Whoah another vim + Meteor user! Do you mind sharing you vim configs? I’d like to learn and see how you do somethings.
here’s mine btw:

I vaguely remember when I was using vim exclusively for Ruby on Rails development I had a pretty fancy setup combining vim and tmux to map certain keystrokes to “run the nearest test to the cursor” etc. and the output will be in another tmux pane, but in the same terminal window. This made for extremely fast feedback loops and saved me from ‘just run tests in another terminal’. I believe GitHub - vim-test/vim-test: Run your tests at the speed of thought does something similar, but I switched completely to vscode since then, so I never tried it.

Happy to share. Here’s what I’ve got so far; keep in mind I’m only a week or two in so this may change, but I’ve tried to follow whatever best practices I could find. Much of it is just general Vim customization. Coc.nvim pulls the most weight, providing auto-complete, eslint integration, and other things I’d otherwise miss from VS Code. I was able to get Coc to recognize imports with an absolute path ("/imports/client/Thingy.js") with the importModuleSpecifier lines in coc-settings.json (:CocConfig opens that file) and the compilerOptions settings in jsconfig.json (sans checkJs), so I now have autocomplete working on all my imports which is something I hadn’t figured out in VS Code (probably because I needed to set those settings there too).

@alihuber Yeah, I feel like vim-test is probably part of the solution here, but I was wrestling with it for a couple hours and didn’t really get anywhere. I want those fast feedback loops…

1 Like