morficus / cypress-dotenv

Cypress plugin that enables compatability with dotenv
53 stars 13 forks source link

TypeError: config is not a function #16

Closed pixelass closed 3 years ago

pixelass commented 3 years ago
cypress

cypress/plugins/index.js

const dotenvPlugin = require("cypress-dotenv");
module.exports = (on, config) => {
    config = dotenvPlugin(config);
    return config;
};

versions:

"cypress": "^5.5.0",
"cypress-dotenv": "^1.2.2",
"dotenv": "^8.2.0",
m4x3d commented 3 years ago

I know its a bit late, but possibly it helps another person. Just use an ES6 import instead of require, like this:

import dotenvPlugin from 'cypress-dotenv';

pixelass commented 3 years ago

also:

const {default: dotenvPlugin} = require("cypress-dotenv");