Set `defaultNycOptions` via environment variables.

未关闭
#529 0 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
cypress, github-actions, javascript
领域
ci-cd, testing

调研方向

从 common-utils.js 开始,检查 NYC 的 report-dir 选项目前是如何定义的,以及在 Cypress coverage 运行期间如何使用。检查仓库中现有的测试和 GitHub Actions 配置,了解与 coverage 相关的行为。当运行时环境变量可以选择并行报告目录,同时现有默认值仍然有效时,即表示完成。

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

描述

Is your feature request related to a problem? Please describe.
I am running my Cypress tests in parallel via GitHub Actions, on multiple VMs.
I want each tests coverage to be written to a different directory so that they may later be merged.
The report-dir for NYC therefore needs to differ for each parallelized test.
This repo only supports a static value for report-dir as defined as code in the NYC config..
I would like for the report-dir value to be variable and set at runtime by the GitHub Action.

Describe the solution you'd like
In common-utils.js, the report-dir property should be set to something like process.env.CYPRESS_REPORT_DIR || './coverage', allowing me to set the CYPRESS_REPORT_DIR environment variable for each parallelized test in the action.

Describe alternatives you've considered
Adding a step to the action that writes a second NYC file (e.g. YAML) or overrides the JSON NYC config to set the report-dir manually, but I'm pretty opposed to having such manual script management in my actions when it can be abstracted here.

I've unblocked myself by converting my NYC config file from JSON to JS and referencing process.env there, but I don't like the repetition here: my NYC config references NYC_REPORT_DIR while my Cypress plugin file sets NYC_REPORT_DIR. I'm still having to manage an environment variable in code that could (should?) be abstracted away via native support.

主要语言
TypeScript
星标
440
派生
114
平均合并
42 分钟
30 天内合并 PR
19

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cypress-io/code-coverage 的其他 Issue

查看 cypress-io/code-coverage 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。