4

We're using gulp-karma plugin to gulp for our testing and PhantomJS. We're running on Windows and PhantomJS is a .exe file. Our files that has the tests has grown and now we're getting the error "spawn ENAMETOOLONG". From what I've gather from this answer: https://github.com/dbushell/grunt-svg2png/issues/17 for Grunt is that the problem is the parameters sendt to PhantomJS is too large. Have anyone had simlar problems or know any work arounds for it (except having to merge test files into fewer files)?

Error message:

[14:20:19] Starting Karma server...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENAMETOOLONG
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Arne H. Bitubekk
  • 2,963
  • 1
  • 27
  • 34

1 Answers1

5

Give files list into karma config instead of gulp.src()
Example


    var files =[
      'lib/**/*.js',
      'src/**/*.js',
      'test/**/*.js'
    ],
    gulp.task('unit.test', function() {
      return gulp.src([])
        .pipe(karma({
          configFile: 'my.karma.conf.js',
          files : files,
          action: 'run'
        }))
        .on('error', function(err) {
          throw err;
        });
    });

sundaramss
  • 66
  • 2
  • Thanks for the reply Sundaramss +1 for that! It seems PhantomJS has some problems parsing the wildcards in file names though. I get an error that the module is not available. It does work when I pass the full path to the files but then again I run into same problems with the string ending up being too long when I get several files – Arne H. Bitubekk Apr 30 '15 at 12:37