webdriverio-boneyard / gulp-webdriver

gulp-webdriver is a gulp plugin to run selenium tests with the WebdriverIO testrunner
http://webdriver.io
MIT License
76 stars 33 forks source link

Unhandled 'error' event when assertion fails #48

Closed albanul closed 8 years ago

albanul commented 8 years ago

When assertion fails an error appears in command line

events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: wdio exited with code 1

Plumber says that error is in gulp-webdriver plugin

Plumber found unhandled error:
 Error in plugin 'gulp-webdriver'
Message:
    wdio exited with code 1

My gulpfile

gulp.task('webio', function() {
    gulp.src('wdio.conf.js')
        //.pipe(plumber())
        .pipe(webdriver());
});

Test script

var chai = require('chai'),
    assert = chai.assert;

describe('tests', function () {
    it('fail', function () {
        assert.equal(1, 0);
    });

    it('success', function () {
        assert.equal(1,1);
    });
});

Everything seems to be working except the error at the end. This error appears since version 2.0.1. Is it a normal behaviour or I am doing something wrong? I am using webdriverio@4.2.8 and gulp-webdriver@2.0.2 Thanks!

christian-bromann commented 8 years ago

@albanul your reporter should tell you what happened, doesn't it?

albanul commented 8 years ago

@christian-bromann yes it does, it tells that some of tests passed and some failed, but then it says that somewhere in code there is an unhandled exception and this is a little bit strange for me.

For example, when I run the same test via gulp-mocha

gulp.task('mocha', function () {
    gulp.src('scripts/tests/tests.js')
        .pipe(mocha());
});

I get this output:

[22:31:42] Using gulpfile ~\WebstormProjects\webio\gulpfile.js
[22:31:42] Starting 'mocha'...
[22:31:42] Finished 'mocha' after 12 ms

  test
    1) fail
    √ success

  1 passing (24ms)
  1 failing

  1) test fail:
     AssertionError: expected 1 to equal 0
      at Context.<anonymous> (C:\Users\Alex\WebstormProjects\webio\scripts\tests\tests.js:9:10)
      at callFn (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runnable.js:334:21)
      at Test.Runnable.run (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runnable.js:327:7)
      at Runner.runTest (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:429:10)
      at C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:535:12
      at next (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:349:14)
      at C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:359:7
      at next (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:285:14)
      at Immediate._onImmediate (C:\Users\Alex\WebstormProjects\webio\node_modules\mocha\lib\runner.js:327:5)

Process finished with exit code 0

Without any exceptions. Same behavior when I run directly via mocha without gulp. But when I run it via gulp-webdriver I get the same output and the exception message

[22:40:06] Using gulpfile ~\WebstormProjects\webio\gulpfile.js
[22:40:06] Starting 'webio'...
[22:40:06] Finished 'webio' after 12 ms
------------------------------------------------------------------
[chrome #0a] Session ID: d5116664-31db-49ff-bb63-a08d4b52453b
[chrome #0a] Spec: C:\Users\Alex\WebstormProjects\webio\scripts\tests\tests.js
[chrome #0a] Running: chrome
[chrome #0a]
[chrome #0a]   test
[chrome #0a]       1) fail
[chrome #0a]       √ success
[chrome #0a]
[chrome #0a]
[chrome #0a] 1 passing (4s)
[chrome #0a] 1 failing
[chrome #0a]
[chrome #0a] 1) test fail:
[chrome #0a] expected 1 to equal 0
[chrome #0a] AssertionError: expected 1 to equal 0
[chrome #0a]     at Context.<anonymous> (C:\Users\Alex\WebstormProjects\webio\scripts\tests\tests.js:9:10)
[chrome #0a]     at C:\Users\Alex\WebstormProjects\webio\node_modules\wdio-mocha-framework\node_modules\wdio-sync\build\index.js:642:26
[chrome #0a]     at Context.executeSync (C:\Users\Alex\WebstormProjects\webio\node_modules\wdio-mocha-framework\node_modules\wdio-sync\build\index.js:640:12)
[chrome #0a]     at C:\Users\Alex\WebstormProjects\webio\node_modules\wdio-mocha-framework\node_modules\wdio-sync\build\index.js:877:34
[chrome #0a]

events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: wdio exited with code 1

Process finished with exit code 1
christian-bromann commented 8 years ago

That looks right to me. The test failed and you see the error at the end of the test. What do you miss here?

beeFlaherty commented 7 years ago

I am encountering this issue as well. The un-handled error from the gulp-webdriver plugin stops my gulpscript process, this is preventing me from running my test suite across multiple config files.

After starting the server I'm currently using the following to run the tests:

gulp.src(path.join(__dirname, 'int-config/*.conf.js')).pipe(webdriver());

Am i missing something or is there another way of doing this?

codeunifier commented 5 years ago

Also getting this issue. @christian-bromann will there be any progress made on this?