0

It's a really simple setup. I'm actually following along with the modern vim book. (I've been using vim emulation on IDEs for years and want to fully dive in).

Anyway, my project structure is:

  • jasmine-test
    • lib/
      • homophoner.js
    • node_modules/
    • spec/
      • Support/
      • jasmine.json
      • homophonerSpec.js
    • .gitignore
    • package.json

Opening the homophonerSpec.js file and running the :TestSuite command outputs the message "Not a test file" (I have tried running nvim and vim from Windows Terminal)

Note: I only have jasmine installed locally in the package.json file.

{
  "name": "test-jasmine",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "private": true,
  "scripts": {
    "test": "jasmine"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "jasmine": "^2.8.0",
    "lodash-node": "^3.10.2"
  }
}

I've tried going through the README, but I cannot find anything that I'm supposed to do. I must be missing a dependency.

I've tried in both vim and nvim wth the same result.

This is the plugin that I am using to try to run the tests https://github.com/vim-test/vim-test

And here's the issue on GitHub.

3
  • Are you running vim from the top directory? As in, cd jasmint-test, then vim spec/homophonerSpec.js? I can see how it would need to be in the top-level directory to properly detect which testing framework is in use...
    – filbranden
    Jun 14 at 16:58
  • Yes, my steps have been: 1. cd jasmine-test 2. vim 3. (In Vim) e: spec/homophonerSpec.js My working directory should be jasmine_test.
    – Geoff
    Jun 14 at 23:15
  • Not sure if it's important but I installed the plugin using minpac (instead of vim-plug per the readme). And I'm running vim/nvim via a window's terminal window
    – Geoff
    Jun 14 at 23:19
1

So I found the issue and a workaround. The issue is on Windows the path separator is \ and not / as is written in the code.

There is also a Windows in jasmine.vim when using the jasmine executable from within node_modules also related to path separators.

I will raise a PR to the vim-test github repo to resolve this, but here is a workaround for windows:

let g:test#javascript#jasmine#file_pattern = '\v^spec[\\/].*spec\.(js|jsx|coffee)$'
let test#javascript#jasmine#executable = 'npx jasmine'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.