Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got ReferenceError: require is not defined #565

Open
daisypreeti opened this issue May 24, 2024 · 1 comment
Open

Got ReferenceError: require is not defined #565

daisypreeti opened this issue May 24, 2024 · 1 comment
Labels
not a bug Problem is not a bug support

Comments

@daisypreeti
Copy link

Describe the bug
Got ReferenceError: require is not defined

To Reproduce
After installing run the test

Expected behavior
instead of require what else we can use to configure in the cypress.config.ts

@javierbrea javierbrea added support not a bug Problem is not a bug labels May 27, 2024
@javierbrea
Copy link
Owner

Hi @daisypreeti ,

I suppose that you are referring to install the plugin node events in the Cypress configuration. And it seems that you are trying to install it in a TypeScript config by copying directly the installation example in the docs, am I right? (please, next time provide more context, details, code examples, etc.)

Anyway, note that the plugin is a CommonJS module, and, so, you should use the appropriated syntax when importing it in TypeScript

For example:

import plugin = require("cypress-localstorage-commands/plugin");

export default {
  e2e: {
    setupNodeEvents(on, config) {
      plugin(on, config);
    },
  },
}

I hope this helps. Please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Problem is not a bug support
Projects
None yet
Development

No branches or pull requests

2 participants