Skip to content

Error message ' Error in "<unknown test>" ' is logging in case of using jasmineNodeOpts setting failFast #5239

@mshykov

Description

@mshykov

Environment (please complete the following information):

  • WebdriverIO version: [5.22.4]
  • Mode: [Standalone mode]
  • If WDIO Testrunner, running sync/async: [sync]
  • Node.js version: [10.19.0]
  • NPM version: [6.14.4]
  • Browser name and version: [Chrome 80.0.3987.163]
  • Platform name and version: [Mac OS X]
  • Additional wdio packages used (if applicable):
 "devDependencies": {
    "@wdio/allure-reporter": "^5.22.4",
    "@wdio/browserstack-service": "^5.22.1",
    "@wdio/cli": "^5.22.4",
    "@wdio/jasmine-framework": "^5.18.6",
    "@wdio/local-runner": "^5.22.4",
    "@wdio/selenium-standalone-service": "^5.16.10",
    "@wdio/spec-reporter": "^5.22.4",
    "@wdio/sync": "^5.18.7",
    "webdriverio": "5.22.4",
},

Config of WebdriverIO

exports.config = {
  bail: 0,
  framework: 'jasmine',
  jasmineNodeOpts: {
    defaultTimeoutInterval: 100000,
    failFast: true,
    stopSpecOnExpectationFailure: true,
    grep: null,
    invertGrep: null,
  },
};

Describe the bug
Extra message is logging in case jasmineNodeOpts contains the setting failFast: true:
Error in "<unknown test>"

To Reproduce

describe('My test: describe', () => {
  beforeAll(() => {
    console.log('beforeAll');
    throw new Error('before all error');
  });
  beforeEach(() => {
    console.log('beforeEach');
  });
  it('My test: it #1', () => {
    console.log('My test: it #1');
  });
  it('My test: it #2', () => {
    console.log('My test: it #2');
  });
  afterEach(() => {
    console.log('afterEach');
  });
  afterAll(() => {
    console.log('afterAll');
  });
});

Expected behavior
As the setting failFast: true interrupts executing of all hooks in the spec, any additional messages should not be logged after failure appears
Exception: afterAll() hook after jasmine issue 1533 will be implemented

Log

Execution of 1 spec files started at 2020-04-09T12:32:37.778Z

[0-0] RUNNING in chrome - /my-test.js
[0-0] beforeAll
[0-0] Error in ""before all" hook"
before all error
[0-0] Error in "<unknown test>"
Error: before all error
[0-0] FAILED in chrome -/my-test.js

 "spec" Reporter:
------------------------------------------------------------------
[chrome 80.0.3987.163 Mac OS X #0-0] Spec: /my-test.js
[chrome 80.0.3987.163 Mac OS X #0-0] Running: chrome (v80.0.3987.163) on Mac OS X
[chrome 80.0.3987.163 Mac OS X #0-0] Session ID: e3b43cc63cfe305a340a5fa7047fdbe5
[chrome 80.0.3987.163 Mac OS X #0-0]
[chrome 80.0.3987.163 Mac OS X #0-0] My test: describe
[chrome 80.0.3987.163 Mac OS X #0-0]    ✖ "before all" hook
[chrome 80.0.3987.163 Mac OS X #0-0]    ✖ <unknown test>
[chrome 80.0.3987.163 Mac OS X #0-0]
[chrome 80.0.3987.163 Mac OS X #0-0] 2 failing (4.4s)
[chrome 80.0.3987.163 Mac OS X #0-0]
[chrome 80.0.3987.163 Mac OS X #0-0] 1) My test: describe "before all" hook
[chrome 80.0.3987.163 Mac OS X #0-0] before all error
[chrome 80.0.3987.163 Mac OS X #0-0]
[chrome 80.0.3987.163 Mac OS X #0-0] 2) My test: describe <unknown test>
[chrome 80.0.3987.163 Mac OS X #0-0] Error: before all error
[chrome 80.0.3987.163 Mac OS X #0-0] Error: before all error
[chrome 80.0.3987.163 Mac OS X #0-0]     at UserContext.<anonymous> (/my-test.js:6:11)

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:09 

Metadata

Metadata

Assignees

No one assigned

    Labels

    first-timers-onlyIssues that are well described and directed for people that start contributing to the projectgood first picka reasonable task to start getting familiar with the code basehelp wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions