Need a way to inspect node.js / Mocha code for ".only" before checking into VCS/Git
We have a lot of unit and integration tests in our node.js codebase.
When adding/updating our code it's convenient to run just our NEW tests, rather than all of them. Mocha makes this easy, by adding ".only" to the test/describe that you want to run. For example, we'll have this:
it.only('should get an index of event moments', function(done) {
...
However, myself and just about all the other developers continuously and accidentally check in this code to Git. When it's merged to master, then only that one test will run for everyone. That defeats the purpose of having all the tests! This happens often enough that we really want to do something about it.
It seems like it would be great to have a code inpector that will warn you when you check in code which searches for a regex like "/.*\.only(/i", or some similar technique.
I've look at the webstorm/phpstorm docs but I can't see any easy way to add such a feature.
Anyone have any ideas?
JB
However, myself and just about all the other developers continuously and accidentally check in this code to Git. When it's merged to master, then only that one test will run for everyone. That defeats the purpose of having all the tests! This happens often enough that we really want to do something about it.
It seems like it would be great to have a code inpector that will warn you when you check in code which searches for a regex like "/.*\.only(/i", or some similar technique.
I've look at the webstorm/phpstorm docs but I can't see any easy way to add such a feature.
Anyone have any ideas?
JB
Please sign in to leave a comment.
Hi there,
You cannot add your own inspection just like that AFAIK -- it needs to be coded as plugin.
The only idea that I have is:
Commit screen has "Before commit" section, which has 2 interesting options:
Thanks Andriy, I'll read up on those options. I just didn't want to miss something obvious.