Skip to content

Exception in Before block w/ Mocha causes test not to report failure #1287

@DevinWatson

Description

@DevinWatson

What are you trying to achieve?

Trying to get all tests to accurately report their results.

What do you get instead?

If there is a exception in a before block Mocha will try and open a screenshot with a invalid path. The single quotes surrounding 'before_all' are not escaped. This causes the current test to not report it's failure resulting in a passing status when there are failed tests.

(node:120) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/project-dir/Test_Name_'before_all'_hook__BeforeSuite.failed.png'
at Object.fs.openSync (fs.js:660:18)
at Object.fs.readFileSync (fs.js:565:33)
at recorder.add (/app/node_modules/codeceptjs/lib/plugin/screenshotOnFail.js:96:65)
at
at process._tickCallback (internal/process/next_tick.js:182:7)
(node:120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Details

  • CodeceptJS version: 1.4.2
  • NodeJS Version: v10.9.0
  • Operating System: OSX 10.13
  • Puppeteer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions