jeudi 20 décembre 2018

How to initiate a cypress plugin

I just started to learn cypress. I'm having a hard time understanding how plugins work.

In the docs regarding cypress/plugins/index.js file they say

Inside of this file, you will export a function. Cypress will call this function, pass you the project’s configuration, and enable you to bind to the events exposed.

I have my config.json and config.env.json set up. So in my plugin's index.js file, I want to see what config contains:

module.exports = (on, config) => {
 console.log('config', config)
}

But when I run the test, nothing logs in the console. I've tried restarting the cypress, it didn't help.

I want to override some of the configs like they do in the docs https://docs.cypress.io/api/plugins/configuration-api.html#Usage.

So when does this file actually executes and how I can see what's in the config argument?

Thanks.

Aucun commentaire:

Enregistrer un commentaire