bahmutov / local-cypress

Use Cypress without global objects
https://glebbahmutov.com/blog/local-cypress/
33 stars 3 forks source link

Idea: Provide .d.ts file of the removed types to allow e2e types to use globals #77

Open cg-roling opened 1 year ago

cg-roling commented 1 year ago

I'm really just wrapping my head around how this all works, so apologies if this isn't actually possible.

My understanding is that local-cypress:

  1. Patches the Cypress package to comment out global type declarations
  2. Provides those fomerly-global types to be imported into tests

In our Angular project, we have lots and lots of e2e tests that work just fine with the global types.

We're just starting to get into component tests, and would like to put the side-by-side with the components themselves, so local-cypress seems necessary to get around type conflicts with our Jasmine tests.

If local-cypress provided a .d.ts file with the global types it removed from Cypress, I believe I could reference that in my Cypress directory to allow the e2e tests to have global types, while using local types for the component tests.

Currently I'm working around doing exactly this by creating a .d.ts file locally with all of the removed types, but it would be nice if that were done internally in local-cypress, so that it can't get out of sync.

Thoughts? Maybe there's an easy way to do all of this and I'm making way too much work out of it?