Do not generate a coverage report when visiting local HTML files with `expectBackendCoverageOnly` enabled

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

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

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

評価

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

調査の方向性

cypress/plugins/index.js から始め、baseUrl が null に設定され、expectBackendCoverageOnly が有効な場合に、コードカバレッジ設定が cy.visit をどのように処理するかを追跡します。Issue にある 2 つの visit を再現し、ローカルの cypress/downloads/test.html のケースと外部 URL を比較します。ローカル HTML への visit で no-coverage-information エラーが発生しなくなり、バックエンドのカバレッジが引き続き機能すれば完了です。

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

説明

Problem:
When visiting a local HTML file (cypress/downloads/test.html), the coverage report is not generated. However, when visiting an external URL like https://docs.cypress.io/app/tooling/code-coverage, the coverage report is successfully generated.

and the error message is code-coverage/test-apps/backend/.nyc_output/out.json has no coverage information Did you forget to instrument your web application?

Cypress Configuration:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  fixturesFolder: false,
  env: {
    codeCoverage: {
      url: 'http://localhost:3003/__coverage__',
      expectBackendCoverageOnly: true
    },
  },
  e2e: {
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
    baseUrl: 'http://localhost:3003',
  },
})

Test Spec:

/// <reference types="Cypress" />

context('Converage Test', () => {
  it('backend test', function() {
    cy.visit('/')
    cy.request('/hello')
  })


  it('visit local html file', {baseUrl: null}, () => {
    cy.visit('cypress/downloads/test.html') // failed to generate coverage report
    // cy.visit('https://docs.cypress.io/app/tooling/code-coverage') //Successfully generated the coverage report.
  })
})
主要言語
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 を短くまとめたダイジェスト。