Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
@kingconan

Description

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.
 })
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /