Why does nrwl nx create a separate e2e project for each app?
Asked Answered
S

1

14

When creating a new nx workspace (i.e. with create-nx-workspace) and then generating an app (with ng g app) it creates an app folder inside the apps folder (so far so good) and also another app-e2e folder, also inside the apps folder. In my mind it would make much more sense to create an e2e folder inside the app folder, next to the src folder, since the e2e tests should belong to that specific app and also it won't clutter the apps folder that way.

So what is the reasoning behind this convention?

Thanks a lot!

Sciomachy answered 9/8, 2018 at 9:11 Comment(0)
B
9

What is the reasoning behind this convention?

It turns out that it's actually due to the Angular 6 CLI. Nx just uses the built in angular schematics. I wasn't aware of this initially, but you can verify this behavior by creating a new app with ng new app1 and then ng generate application app2 inside of app1. app1 is created with the regular structure, while app2 and a sibling app2-e2e are created inside a default projects directory within app1.

Initially, I had the same question as you. I have been manually restructuring every newly generated app in my nx workspace so that the e2e folder is inside of its respective app folder. This led me to create a feature request in the nx repo. The underlying Angular CLI 6 convention was explained to me after I opened a PR for this functionality.

Bigford answered 20/9, 2018 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.