You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cucumber多配置文件迁移至ESM格式后default配置无法识别求助

Cucumber JS ESM配置不生效的解决方法

问题核心是Cucumber对ESM格式配置文件的导出规则:ESM配置必须使用命名导出export const config,而非默认导出export default。

修正后的ESM配置代码

const common = {
  // ...你的公共配置内容
};

export const config = {
  ci: {
    ...common,
    format: [
      "progress",
    ],
  },
  default: {
    ...common,
    format: [
      "progress-bar",
    ],
  },
};

注意事项

  • 保留package.json中的"type": "module"配置,确保Node.js以ESM模式加载配置文件。
  • 运行命令和原逻辑一致:指定配置用npx cucumber-js --profile ci,不指定时自动启用default配置。

内容的提问来源于stack exchange,提问作者user4695271

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 01:45:34