karma: test files are unexpectedly removed when edited by certain editors

Using:

$ testacular --version
Testacular version: 0.5.5

It appears that, when saving, some editors (e.g vim) move the original file (to preserve it as a backup) and create a new file, rather than updating the file in place.

As a result Testacular (almost always) removes the edited file:

info (watcher): Removed file "/path/to//test/unit/controllersSpec.js".

Future changes to the file are no longer detected. Once is forced to restart Testacular.

Note, Testacular behaves normally (recognizing the file has been updated) when one simply touches the file:

$ touch test/unit/controllersSpec.js

A workaround is to specify an explicit file backup policy, i.e. in the vim case by adding :set backupcopy=yes to your ~/.vimrc:

"backupcopy                                                                     
"    "yes"   make a copy of the file and overwrite the original one             
"    "no"    rename the file and write a new one                                
"    "auto"  one of the previous, what works best                               
:set backupcopy=yes

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 28 (15 by maintainers)

Most upvoted comments

I just ran into this problem with karma 1.1.2 I can confirm disabling ‘safe write’ in Intellij “solves” the problem.

same issue with karma v0.13.21