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

State of hook causes testrunner to crash #34

Closed
dragancla opened this issue Jul 17, 2019 · 7 comments
Closed

State of hook causes testrunner to crash #34

dragancla opened this issue Jul 17, 2019 · 7 comments
Assignees
Labels

Comments

@dragancla
Copy link

dragancla commented Jul 17, 2019

Ever since version 1.3.0 the testrunner crashes if a test fails in a beforeEach mocha hook, which produces a domino-effect where, at the end of the suite, reportPortal sees the failing tests as "IN_PROGRESS" so it can't finish the suite launch <- unrelated, just submitted a bug for that as well

We reverted back to 1.2.0 and everything is fine.

Steps to reproduce:

describe('Should not crash testrunner in beforeEach', () => {

    beforeEach(() => {
        expect(1).to.equal(2);
    });

    it('should be true', () => {
        expect(1).to.equal(1);
    });

});

Stack trace:

[5-28] 2019-07-17T08:39:00.811Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot read property 'length' of undefined
    at module.exports (/usr/src/app/node_modules/wdio-json-reporter/src/mapHooks.js:13:40)
    at JsonReporter.prepareJson (/usr/src/app/node_modules/wdio-json-reporter/src/index.js:31:35)
    at JsonReporter.onRunnerEnd (/usr/src/app/node_modules/wdio-json-reporter/src/index.js:13:25)
    at JsonReporter.WDIOReporter.on.runner (/usr/src/app/node_modules/@wdio/reporter/build/index.js:181:12)
    at JsonReporter.emit (events.js:182:13)
    at JsonReporter.EventEmitter.emit (domain.js:442:20)
    at reporters.forEach.reporter (/usr/src/app/node_modules/@wdio/runner/build/reporter.js:61:49)
    at Array.forEach (<anonymous>)
    at BaseReporter.emit (/usr/src/app/node_modules/@wdio/runner/build/reporter.js:61:20)
    at Runner.run (/usr/src/app/node_modules/@wdio/runner/build/index.js:188:19)

[2-65] 2019-07-17T08:48:31.367Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot read property 'length' of undefined
    at module.exports (/usr/src/app/node_modules/wdio-json-reporter/src/mapHooks.js:13:40)
    at JsonReporter.prepareJson (/usr/src/app/node_modules/wdio-json-reporter/src/index.js:31:35)
    at JsonReporter.onRunnerEnd (/usr/src/app/node_modules/wdio-json-reporter/src/index.js:13:25)
    at JsonReporter.WDIOReporter.on.runner (/usr/src/app/node_modules/@wdio/reporter/build/index.js:181:12)
    at JsonReporter.emit (events.js:182:13)
    at JsonReporter.EventEmitter.emit (domain.js:442:20)
    at reporters.forEach.reporter (/usr/src/app/node_modules/@wdio/runner/build/reporter.js:61:49)
    at Array.forEach (<anonymous>)
    at BaseReporter.emit (/usr/src/app/node_modules/@wdio/runner/build/reporter.js:61:20)
    at Runner.run (/usr/src/app/node_modules/@wdio/runner/build/index.js:188:19)
@dragancla
Copy link
Author

@fijijavis :)

@fijijavis fijijavis self-assigned this Jul 17, 2019
@fijijavis fijijavis added the bug label Jul 17, 2019
@fijijavis
Copy link
Collaborator

@dragancla Are you using Mocha as your test runner? If so which version? I see what is probably causing the error but I'm unable to reproduce it with a minimal wdio example. Maybe share your package.json?

@dragancla
Copy link
Author

dragancla commented Jul 18, 2019

We're using the latest mocha-framework provided by @wdio https://www.npmjs.com/package/@wdio/mocha-framework

  "dependencies": {
    "@wdio/appium-service": "^5.11.4",
    "@wdio/cli": "^5.11.5",
    "@wdio/local-runner": "^5.10.9",
    "@wdio/mocha-framework": "^5.11.0",
    "@wdio/selenium-standalone-service": "^5.11.2",
    "@wdio/spec-reporter": "^5.11.0",
    "@wdio/sync": "^5.10.8",
    "appium": "^1.14.0",
    "chai": "^4.1.2",
    "mocha-testrail-reporter": "^1.0.12",
    "wdio-image-comparison-service": "^1.2.0",
    "wdio-json-reporter": "1.2.0",
    "wdio-reportportal-reporter": "^5.0.1",
    "wdio-reportportal-service": "^5.0.2",
    "wdio-testrail-reporter": "^1.1.5",
    "webdriverio": "^5.11.5"
  }

@fijijavis
Copy link
Collaborator

@dragancla I finally figured out my issue... i didn't have the reporter setup in my wdio conf 🤒 🤦‍♂ Should have a fix out today.

@fijijavis
Copy link
Collaborator

fijijavis commented Jul 23, 2019

@dragancla v1.3.1 has been published. It should take care of your issue

@dragancla
Copy link
Author

@fijijavis Thanks! Testing it now

@dragancla
Copy link
Author

Stressed it properly, no errors so far. Good job, thanks! 👍

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

No branches or pull requests

2 participants