0

If you have separate repositories for library and consumer, the custom commands defined in one repository(library) is not available in consumer repository. I get cy.samplecommmand() is not a function error

Is there a way to use custom commands from one repository in another repository?

Cypress from consumer repository couldn’t able to identify the commands from library tried adding ../support/commands in library package

Ingrid.Tesch
  • 142
  • 7
as18
  • 1
  • 1
    Can’t you just import the command you need it in the support file? If needed, you can release a private library package on npm, and install it normally. – wlecki Jun 13 '23 at 08:02
  • Added a import statement in command.js(consumer package) referring to node modules worked for me. Example import “@ex/librarypackage/dist/support/command.js” – as18 Jun 14 '23 at 03:52
  • You should also have an index.ts or index.js file under support. It should include an import of the commands import './commands'; index.ts/sj will load before anything else and then make your custom command available everywhere in your project. I'm not sure what you mean by library and consumer repos. Are these two different cypress projects? – rmnrdi Jul 06 '23 at 16:32

0 Answers0