I'm using ExpressJS and have created unit tests with mocha along with coverage using istanbul nyc. I have implemented a route (see code below) and am verifying code coverage of my tests.
The following registers as 100% covered,
import express from 'express';
import controller from './controller';
export default express
.Router()
.get('/', (req, res) => controller.all(req, res));
But the following registers at 0% coverage:
import express from 'express';
import controller from './controller';
export default express
.Router()
.get('/', controller.all);
Both work and both pass unit tests. The second, IMO, 'should' also register at 100% covered.
Any ideas how to make the second version register? And why it doesn't work as is?
Note: I'm using mocha for my tests. The logic above is not the test logic, but logic that is ultimately invoked by my test