Allow for declaring the nycrcPath to use custom-named configuration files.

Đang mở
#967 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cypress, typescript
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi cách cấu hình Cypress đọc các thiết lập NYC và cách plugin hiện tìm các tệp .nycrc mặc định. Kiểm tra các bài kiểm thử cấu hình và coverage hiện có, sau đó xác minh khả năng hỗ trợ một đường dẫn tùy chỉnh được cung cấp qua config.nycrcPath hoặc config.env.nycrcPath. Hoàn tất khi Cypress sử dụng cấu hình đã chọn mà vẫn giữ nguyên hành vi mặc định hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem? Please describe.
Right now, this plugin supports loading default named ".nycrcfiles, but cannot utilize a custom named one, like.nycrc.config.cypress.js`. An option to provide custom configuration options exist for other test frameworks, like vitest.

Specifically in the case I am using, I need to have distinct outputs between unit and component test coverage, where Vitest handles unit tests, and Cypress handles component tests. This is due to limitations of how Cypress handles source maps versus Vitest where line lengths do not align properly (and this is well-documented in this repo and in the official nyc repo as well). To avoid that issue, I need separate .nycrc configs for both test frameworks.

Cypress currently only supports default named .nycrc files, or a configuration defined in the package.json, but this limits how we can use nyc as it prefers the configuration used for Cypress over any other configurations that can exist. This is a problem if we need to merge results and report on total coverage combined by both, running nyc report will ignore the files matched in the unit test configuration.

Describe the solution you'd like
The plugin should allow for calling a custom nycrcPath when being declared in the Cypress configuration, either by config.nycrcPath or config.env.nycrcPath.

For an example, see here:
https://github.com/iFaxity/vite-plugin-istanbul?tab=readme-ov-file#istanbulplugin--opts--

Describe alternatives you've considered
I will need to use three .nycrc configurations which is incredibly messy:

  • .nycrc.config.mjs, a default config used only for accurate reporting of merged component + unit test code coverage results. This would be called in a command like npx nyc report --nycrc-path=./.nycrc.config.mjs. Specifying the path is necessary here.
  • .nycrc.config.component.mjs, a Cypress-specific configuration extended from the default; it must be loaded as part of the package.json using "nyc": { "extends": "./.nycrc.config.component.mjs" }. Running npx nyc report without declaring the path will utilize this config instead of the default, which is the main issue.
  • .nycrc.config.unit.mjs for Vitest files only.

Additional context
Add any other context or screenshots about the feature request here.

Ngôn ngữ chính
TypeScript
Star
440
Fork
114
Merge trung bình
42 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cypress-io/code-coverage

Tất cả issue của cypress-io/code-coverage

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.