Gulp mocha istanbul get 100% for nothing
<p>I use the following code and It was able to generate the mocha test (suite and tests) report as <strong>expected</strong> but Im not able to see the <strong><em>mocha test coverage with istanbul</em></strong> what am I missing here?</p>

<pre><code>gulp.task('test', function () {
    gulp.src(['./assets/**/js/*.js'])//Here I took it from the repo
        .pipe(istanbul())
        .pipe(tap(function (f) {
            require(f.path);
        }))
        .on('end', function () {
            gulp.src(['test/*spec.js'])//this is the path for my tests
                .pipe(mocha({
                    reporter: 'mochawesome'
                }))
                .pipe(istanbul.writeReports(
                    ['unit-test-coverage']
                ));
        });
});
</code></pre>

<p>the following does not generate anything </p>

<pre><code>  .pipe(istanbul.writeReports(
                ['unit-test-coverage']
            ));
</code></pre>

<p>My project look like following</p>

<pre><code>my app
 -server.js
 -app.js
 -contoller
 --file1.js
 --file2.js
 -test
  spec1.js
  spec2.js
 -gulpfile.js
</code></pre>

<ol>
<li>what should I put here?
gulp.src(['./assets/**/js/*.js']) ?</li>
<li>how should I adopt my code to make it work?</li>
</ol>

<p>I use the following
<a href="https://github.com/SBoudrias/gulp-istanbul" rel="nofollow">https://github.com/SBoudrias/gulp-istanbul</a>
and gulp mocha
<a href="https://www.npmjs.com/package/gulp-mocha" rel="nofollow">https://www.npmjs.com/package/gulp-mocha</a></p>

<p><strong>And this is what I got after the code are running</strong></p>

<p>19 passing (15s)</p>

<pre><code>[mochawesome] Report saved to mochawesome-reports/mochawesome.html


----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|


=============================== Coverage summary ===============================
Statements   : 100% ( 0/0 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 0/0 )
Lines        : 100% ( 0/0 )
================================================================================
</code></pre>

<p><strong>UPDATE</strong>
When I do the following it generate an report but the coverge but it seems that the code is not coverage well since I got 100% on of all the tests (I wish :-)) ,any idea what I miss here?
since the mocha unit test run well just the code coverage doesnt work well</p>

<pre><code>            .pipe(istanbul.writeReports({
                dir: './assets/unit-test-coverage',
                reporters: ['html'],
                reportOpts: {dir: './unit-test-coverage'}
            }));
</code></pre>

<p><strong>update 2</strong></p>

<p>I build the same in <b> GRUNT </b> (since I was lost here :-( ) and this is working!!!!!</p>

<p>but still I want to make it work in Gulp, please help!</p>

<p>I try to sperate all the dependcies and create this minor gulp file and run 
just it and still the same issue</p>

<p>This is the new file and I use diffrent technuiqe but same results :(</p>

<pre><code>var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');


gulp.task('pre-test', function () {

    return gulp.src(['./assets/**/js/*.js'])
    // Covering files

        .pipe(istanbul(
            {includeUntested: true}
        ))
        .pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function () {
    return gulp.src(['test/*spec.js'])
        .pipe(mocha({
            reporter: 'mochawesome'
        }))
        // Creating the reports after tests ran
        .pipe(istanbul.writeReports({
            dir: './assets/unit-test-coverage',
            reporters: ['html'],
            reportOpts: {dir: './unit-test-coverage'}
        }))
        .pipe(istanbul.enforceThresholds({thresholds: {global: 90}}));
});

gulp.task('default', [ 'test']);
</code></pre>

<p>WHAT am I missing here? the test file running OK just the coverage...</p>