为什么nrwl nx要为每个app创建一个单独的e2e项目?

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

当创建一个新的 nx 工作区(即使用 create-nx-workspace)然后生成一个应用程序(使用 ng g app)时,它会在应用程序文件夹中创建一个应用程序文件夹(到目前为止还不错)以及另一个应用程序-e2e 文件夹,也在 apps 文件夹内。 在我看来,在 app 文件夹中创建一个 e2e 文件夹更有意义,紧挨着 src 文件夹,因为 e2e 测试应该属于那个特定的应用程序,而且它不会那样弄乱 apps 文件夹。

那么这个约定背后的原因是什么?

非常感谢!

这个约定背后的原因是什么?

事实证明,这实际上是由于 Angular 6 CLI。 Nx 仅使用内置的 angular 原理图。我最初并没有意识到这一点,但您可以通过在 app1 中使用 ng new app1ng generate application app2 创建一个新应用来验证此行为。 app1 是使用常规结构创建的,而 app2 和同级 app2-e2e 是在 app1.

中的默认 projects 目录中创建的

最初,我和你有同样的问题。我一直在我的 nx 工作区中手动重组每个新生成的应用程序,以便 e2e 文件夹位于其各自的应用程序文件夹内。这导致我为此功能创建了一个 feature request in the nx repo. The underlying Angular CLI 6 convention was explained to me after I opened a PR