Creates the test file javascript (spec) of current opened buffer in the same dir

1 Point

Neni Neni

3 months ago

Creates the file "path/to/service.spec.js" of file "path/to/service.js"

fun! CreateOrOpenSpecJS()
    let file = expand('%:r:t') . ".spec." . expand('%:e')
    " silent is necessary if the function is in ftplugin/javascript.vim
    exec "silent! e " . file
endfun