The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript NodeJs – How to bundle tests and start karma from watch task

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #208832

    Whenever the appropriate files change I would like to bundle my tests and start karma, showing any failed tests.

    I currently have the watch task:

    gulp.task('default', ['browserify', 'css','runTests'], function () {'./src/js/**/*.js', ['browserify']);'./src/js/**/*.js', ['runTests']);

    Which starts up the runTests.js

    gulp.task('runTests', function() { var testFile = [ './src/components/tests/suite.js' ]; // bundle tests var cmd = child_process.spawn('browserify', ['-e', 'D:\\Source\\lookedaftercall\\react\\src\\components\\tests\\suite.js', '-t', 'reactify', '-t']); cmd.on('close', function (code) { //cmd finished start karma gulp.src(testFiles) .pipe(karma({ configFile: 'karma.conf.js', action: 'run' })) .on('error', function(err) { throw err; }); });

    my console currently errors here:

    [17:04:27] Starting 'runTests'...
    [17:04:27] Finished 'runTests' after 2.73 ms
      throw er; // Unhandled 'error' event
    Error: spawn browserify ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3
    Process finished with exit code 1

    Can anyone please help? IS there a better way I can automate this process?

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.