Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Exception Handling (e.g. throw new Error) stopped working in the steps

Open
#2,784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js, playwright
Domain
testing

Research direction

Reproduce the provided failing step with CodeceptJS 3.0.4 and the Playwright helper, then compare it with 3.0.2 where the behavior worked. Trace the step execution and exception handling path; done means a thrown Error makes the step fail and appears in the test output.

Written by the indexing model from the issue text.

Description

What are you trying to achieve?

I would like to see the error if step fails with exception
e.g.

Given('I fail the step', () => {
    throw new Error('Error');
 });
What do you get instead?

I can see that step passes

Provide console output if related. Use --verbose mode for more details.

  fail step @fail
  ✔ OK 

Provide test source code if related
Example
My step in a feature file

@fail
  Scenario: fail step
    Given I fail the step

Implementation

 Given('I fail the step', () => {
    throw new Error('Error');
 });

Result

  fail step @fail
  ✔ OK 
Details
  • CodeceptJS version: 3.0.4
  • (With version 3.0.2 everything works fine!)
  • NodeJS Version: 12.19.2 (with 14.15.4 I have the same issue)
  • Operating System: Windows/Mac/Debian
  • playwrigth
  • Configuration file:
exports.config = {
  output: './output',
  helpers: {
    Playwright: {
      browser: process.env.BROWSER || 'chromium',
      windowSize: '1400x800',
      waitForAction: 500,
      waitForNavigation: 'load',
      chromium: {
        args: [
          '--disable-setuid-sandbox',
          '--deterministic-fetch',
          '--no-sandbox',
        ],
      },
      waitForTimeout: 40000,
      disableScreenshots: false,
      uniqueScreenshotNames: true,
      keepBrowserState: false,
      keepCookies: true,
      restart: false,
      locale: 'en_US',
      show: process.env.SHOW === 'true',
    },
helpers etc.
Dominant language
JavaScript
Stars
4.2k
Forks
756
Avg merge
2d 9h
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codeceptjs/CodeceptJS

All issues in codeceptjs/CodeceptJS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.