BREAKING: support specPattern, drop support for integrationFolder

オープン
#536 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cypress, javascript
領域
testing

調査の方向性

まず、パッチが適用された node_modules 内のコピーではなく、support-utils.js と support.js のソース版を見つけます。Cypress.config が testFiles、specPattern、integrationFolder、supportFile をどのように提供しているかを確認し、そのうえで、coverage のフィルタリングが新しい設定に従い、integrationFolder に依存しなくなっていることを検証します。

索引モデルが issue の本文から書いたものです。

説明

Via patch package.


Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @cypress/[email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@cypress/code-coverage/support-utils.js b/node_modules/@cypress/code-coverage/support-utils.js
index 31e00ee..0c56908 100644
--- a/node_modules/@cypress/code-coverage/support-utils.js
+++ b/node_modules/@cypress/code-coverage/support-utils.js
@@ -10,7 +10,7 @@ const filterSpecsFromCoverage = (totalCoverage, config = Cypress.config) => {
   const integrationFolder = config('integrationFolder')
   /** @type {string} Cypress run-time config has test files string pattern */
   // @ts-ignore
-  const testFilePattern = config('testFiles')
+  const testFilePattern = config('specPattern')
 
   // test files chould be:
   //  wild card string "**/*.*" (default)
diff --git a/node_modules/@cypress/code-coverage/support.js b/node_modules/@cypress/code-coverage/support.js
index c99ceb2..f51ce4e 100644
--- a/node_modules/@cypress/code-coverage/support.js
+++ b/node_modules/@cypress/code-coverage/support.js
@@ -37,7 +37,6 @@ const logMessage = (s) => {
  * If there are more files loaded from support folder, also removes them
  */
 const filterSupportFilesFromCoverage = (totalCoverage) => {
-  const integrationFolder = Cypress.config('integrationFolder')
   const supportFile = Cypress.config('supportFile')
 
   /** @type {string} Cypress run-time config has the support folder string */
@@ -50,16 +49,9 @@ const filterSupportFilesFromCoverage = (totalCoverage) => {
     isSupportFile(filename)
   )
 
-  // check the edge case
-  //   if we have files from support folder AND the support folder is not same
-  //   as the integration, or its prefix (this might remove all app source files)
-  //   then remove all files from the support folder
-  if (!integrationFolder.startsWith(supportFolder)) {
-    // remove all covered files from support folder
-    coverage = Cypress._.omitBy(totalCoverage, (fileCoverage, filename) =>
-      filename.startsWith(supportFolder)
-    )
-  }
+  coverage = Cypress._.omitBy(totalCoverage, (fileCoverage, filename) =>
+    filename.startsWith(supportFolder)
+  )
   return coverage
 }
 

This issue body was partially generated by patch-package.

主要言語
TypeScript
スター
440
フォーク
114
平均マージ
42分
マージ済み PR(30日)
19

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cypress-io/code-coverage のほかの issue

cypress-io/code-coverage の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。