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

未關閉
#2,784 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
javascript, node.js, playwright
領域
testing

研究方向

使用 CodeceptJS 3.0.4 和 Playwright helper 重現提供的失敗步驟,然後與行為正常的 3.0.2 進行比較。追蹤步驟執行和例外處理路徑;當拋出的 Error 使步驟失敗並出現在測試輸出中時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
JavaScript
星號
4.2k
分支
756
平均合併
2 天 9 小時
30 天內合併 PR
16

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。