Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp-mocha no longer works with many files #165

Open
rogierschouten opened this issue Mar 8, 2017 · 4 comments
Open

gulp-mocha no longer works with many files #165

rogierschouten opened this issue Mar 8, 2017 · 4 comments

Comments

@rogierschouten
Copy link

On Windows, running gulp-mocha with lots of .js files results in a command line too long error:

Error in plugin 'gulp-mocha'
Message:
    spawn undefined ENOENT
Details:
    errno: ENOENT
    code: ENOENT
    syscall: spawn undefined
    killed: false
    stdout:
    stderr: The command line is too long.

    failed: true
    signal: null
   cmd: mocha  <MANY_JS_FILES_LISTED_HERE> --colors
    timedOut: false
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

This is specific to v4. Downgrading to gulp-mocha version 3.0.1 removes this error.

@leifdejong
Copy link

On Mac too.

Message:
    Command failed: mocha <path to spec> --colors
   stderr: 
    failed: true
    signal: null
    cmd: mocha <path to spec> --colors
    timedOut: false

@jezzsantos
Copy link

On Windows 10, get same problem.
Changing to support long paths in windows, as described here: #154 (comment) did not fix it.

Reverting back to 3.0.1 fixed it.
Version 4.0.0 broke it again!

@lgodmer
Copy link

lgodmer commented Apr 26, 2018

Unfortunately gulp-mocha version 3.0.1 depends on mocha version 3.0.0, which depends on growl 1.9.2 - which has a security vulnerability (tj/node-growl#60)
So downgrading is not an option if you are using a tool to scan your node_modules tree for known vulnerabilities.
The issue is still present in gulp-mocha 5.0.0

@nayan92
Copy link

nayan92 commented Jun 22, 2018

I've been having trouble with this on Windows 10 too. The solution/workaround I've used is to pass the directory containing the tests to mocha rather than all the files. Mocha will then run all the tests in that directory. If you also use the recursive flag, then mocha will look for tests in subdirectories too.

An example:

var gulp = require('gulp');
var mocha = require('gulp-mocha');

gulp.task('run-tests', function() {
    return gulp.src([ /path/to/directory/ ], { read: false })
        .pipe(mocha({
            recursive: true
        }));
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants