Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Using cucumber, scripts exception ends in a passing test

未关闭
#2,773 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
领域
testing

调研方向

使用报告的 CodeceptJS 3.0.4 配置复现该故障,重点关注在 gherkin 部分中配置的 gherkin features 和 steps,并在 UI 和 headless 两种模式下进行。跟踪来自 Cucumber step 的 JavaScript 异常是如何报告的;当 scenario 失败且该异常在两种执行模式下都被记录到日志中时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

What are you trying to achieve?

I am using cucumber to write the tests.

A step for some reasons throws a javascript exception.

What do you get instead?

The scenario execution stops without any log, and test is considered as "passing".

This happens whenever I use the UI executor or the headless mode.

Details
  • CodeceptJS version: 3.0.4
  • NodeJS Version: 14.15.4
  • Operating System:
  • puppeteer
  • Configuration file:
require('ts-node/register');
const { setHeadlessWhen, setSharedCookies } = require('@codeceptjs/configure');

// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);
setSharedCookies();

process.env.TEST_URL = process.env.TEST_URL || 'http://localhost:3000';

// eslint-disable-next-line no-undef
exports.config = {
  tests: './test/**/*.test.ts',
  output: './output',
  helpers: {
    Puppeteer: {
      url: process.env.TEST_URL,
      show: true,
      browser: 'chromium',
      chrome: {
        args: ['--no-sandbox'],
      },
    },
    REST: {
      endpoint: `${process.env.TEST_URL}/api`,
    },
  },
  include: {
    I: './steps_file.ts',
  },
  bootstrap: null,
  mocha: {
    reporterOptions: {
      mochaFile: 'reports/e2e/community-management-web.xml',
    },
  },
  name: 'xxx-e2e',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true,
    },
    tryTo: {
      enabled: true,
    },
    screenshotOnFail: {
      enabled: true,
    },
    allure: {
      enabled: false,
    },
  },
  gherkin: {
    features: './test/features/*.feature',
    steps: [
      './test/step-definitions/base.steps.ts',
      './test/step-definitions/xxx.steps.ts',
      './test/step-definitions/auth.steps.ts'
    ],
  },
};

主要语言
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 摘要。