Code Monkey home page Code Monkey logo

Comments (8)

bahmutov avatar bahmutov commented on June 12, 2024 2

You have overriden the plugins file and only register code coverage tasks. You file should read

const admin = require("firebase-admin");
const cypressFirebasePlugin = require("cypress-firebase").plugin;
module.exports = (on, config) => {
   cypressFirebasePlugin(on, config, admin);   
   require('@cypress/code-coverage/task')(on, config)
   return config
}

from cypress-firebase.

gregfenton avatar gregfenton commented on June 12, 2024 1

I struggled trying to get the examples/basic project running. I was getting TypeScript errors within Cypress complaining about extendWithFirebaseConfig not being a function. I wasted too much time on it so I built my own simple app along with reproduction steps:

https://github.com/gregfenton/cypress-firebase-code-coverage

See the README at the root of the project. Should take 5-10 minutes to get the repro going, depending on whether you go with my Firebase project or you create your own.

(If I remember, I'll tear down that serviceAccount in the next few days, so please let me know if/when you have validated the issue (by "you" I mean the wider github audience...this doesn't all have to fall to @prescottprue !)

from cypress-firebase.

gregfenton avatar gregfenton commented on June 12, 2024 1

@prescottprue - want me to update the README patch accordingly?

from cypress-firebase.

prescottprue avatar prescottprue commented on June 12, 2024

Are you sure you included the plugin? The list of tasks doesn’t seem to include any of the custom cypress-firebase tasks. Can you share the repo so I can be sure to reproduce the issue?

from cypress-firebase.

prescottprue avatar prescottprue commented on June 12, 2024

Thanks for the repro - I'll look into it. I have not kept the examples of this repo as up to date as I should, but instead have mostly been using cypress-firebase in different projects. Glad to have folks like you reminding me to come back and clean up the example/docs - the PRs are much appreciated 😄

from cypress-firebase.

gregfenton avatar gregfenton commented on June 12, 2024

I'm pretty certain this is just going to be a build or runtime config thingy. Somehow we need to convince @cypress/code-coverage and/or nyc to "instrument" callFirestore/callRtdb, or convince them to ignore callFirestore/callRtdb.

My app code is just fine, including all the npms I am using. But cypress-firebase is exposed directly to Cypress, so it isn't going through the same build/startup routines.

from cypress-firebase.

gregfenton avatar gregfenton commented on June 12, 2024

Brilliant, thank you. With the above, I am now running my cypress-firebase tests with code-coverage!!

Wasn't clear to me that the same module.exports was to be used for both code-coverage and other tasks. I'll put up a PR for the code-coverage README to help others in the future.

Thanks @bahmutov and @prescottprue !!!

from cypress-firebase.

prescottprue avatar prescottprue commented on June 12, 2024

Thanks for posting @bahmutov that is right!

If you want the config extending that happens through the plugin as well you can do the following:

const admin = require("firebase-admin");
const cypressFirebasePlugin = require("cypress-firebase").plugin;
module.exports = (on, config) => {
   const newConfig = cypressFirebasePlugin(on, config, admin);   
   require('@cypress/code-coverage/task')(on, config)
   return newConfig
}

from cypress-firebase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.