Correct configuration using Gulp, Mocha, Browserify to run a client-side test with server-side checks

I am working on a node application that uses a gulpbuild and a plugin gulp-mochafor our tester for our processes .

 gulp.task('test', function () {
    return gulp.src(TESTJS)
        .pipe(mocha({reporter: 'spec'}))
        .on("error", function (err) {
            // handle the mocha errors so that they don't cloud the test results,
            // or end the watch
            console.log(err.toString());
            this.emit('end');
        });
 });

Currently, TESTJSthese are just my server tests. I want to use the same process to run my client tests. I looked gulp-blanket-mochaand did it, but I continue to run into the same issue. When trying to test my main code, it fails, because the other client components needed (namely jquery) were not found by the test runner, and it fails. I understand that I need to use some kind of dumb web kit like phantomJS. But I am having real problems with how to incorporate this into this gulp process with browserify.

Has anyone tried to get such a setup or any ideas that I'm missing here, since my "w820>" task does my urine tests on the client side as well as my server side?

+4
1

:

  • Test runner - gulp options.files gulp.src(). , , gulp gulp.
  • phantom/chrome/firefox
  • , alt-js
  • .

.

  • , " ". .
  • karma-bro - - (ATM this - bfy 5.0 api) -.
  • , /-/ . , , , , bfy
  • browserify "" .
  • "transform: []" .
  • , , , -istanbul
+1

Source: https://habr.com/ru/post/1530494/


All Articles