Mocha: Fix middleware filter var

It was loading the mocha div for files that did not have tests
Merge pull request #3590 from nschonni/v4-middleware-fix

Mocha: Fix middleware filter var