nx: Cypress errors when shared lib is imported
Importing from a shared lib into cypress e2e spec, breaks the build process with:
The plugins file is missing or invalid.
Your pluginsFile is set to '...dist/out-tsc/apps/my-app-e2e/src/plugins/index.js', but either the file is missing, it contains a syntax error, or threw an error when required. The pluginsFile must be a .js or .coffee file.
Please fix this, or set 'pluginsFile' to 'false' if a plugins file is not necessary for your project.
Reproduction steps
- create-nx-workspace farm
- ng generate jest
- ng generate application myApp ( pick cypress )
- ng generate lib fixtures --no-module
ng e2e( everything is fine )- Export a const from a shared lib into a cypress spec.
ng e2e( build is broken )
Reproduction Repo https://github.com/golfadas/farm
Angular & node versions Angular CLI: 7.0.1 Node: 10.12.0 OS: darwin x64 Angular: 7.0.2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 14
- Comments: 21 (5 by maintainers)
This is causing us a lot of pain, help!!
No feedback from the NX team 😦
We are actually switching to Webpack internally soon https://github.com/cypress-io/cypress/pull/4103 - this would simplify things. Handles js, ts, coffeescript, jsx/tsx, and scss
Hi all, thanks for your patience waiting for a response.
I bring good news though. 😃 I’ve been experimenting creating a Cypress plugin which would use Webpack to preprocess files. This would allow importing from
tsconfigpaths. 🎉Hey, I have described how to use TypeScript type aliases in Cypress tests in this blog post: https://glebbahmutov.com/blog/using-ts-aliases-in-cypress-tests/
Hint: you need to configure both webpack and tsconfig
For multiple apps reusing helpers, importing interfaces, etc. would be super helpful but basically everything causes the build to break. Is there anyone that could look into this?
@vsavkin @FrozenPandaz thank you so much ❤️
Same issue. Have a lib with all my app Models, can’t use them in cypress.