nx: @nrwl/nx-plugin:e2e does not support plugins using paths from tsconfig.base.json

Current Behavior

When importing within the same workspace plugins e2e fail.

Expected Behavior

I should be able to run e2e tests in plugins workspace when importing within the same workspace.

Steps to Reproduce

  1. Create new nrwl workspace: npx create-nx-plugin my-org --pluginName core
  2. Create second plugin: nx g @nrwl/nx-plugin:plugin serverless
  3. In core create some utility method
  4. Use it in serverless
  5. Run nx e2e serverless-e2e

Repository link.

Failure Logs

    Command failed: npm install --legacy-peer-deps

      at runPackageManagerInstall (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:50:19)
      at newNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:70:3)
      at Object.ensureNxProject (../../packages/nx-plugin/src/utils/testing-utils/nx-project.ts:82:3)
      at tests/serverless.spec.ts:37:7
      at ../../node_modules/tslib/tslib.js:117:75
      at Object.__awaiter (../../node_modules/tslib/tslib.js:113:16)

Environment

  Node : 12.18.3
  OS   : darwin x64
  npm  : 6.14.6

  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 11.3.0
  @nrwl/cypress : Not Found
  @nrwl/devkit : 11.3.0
  @nrwl/eslint-plugin-nx : 11.3.0
  @nrwl/express : Not Found
  @nrwl/jest : 11.3.0
  @nrwl/linter : 11.3.0
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 11.3.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.3.0
  @nrwl/web : Not Found
  @nrwl/workspace : 11.3.0
  typescript : 4.0.7

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 19 (16 by maintainers)

Most upvoted comments

We can reuse the existing ensureNxProject function, but I’d still want to make use of the ...PluginInput syntax - this is to support running e2e on a workspace that has multiple plugins installed which aren’t necessarily related to each other via the project graph.

If we reuse ensureNxProject for this, the syntax shouldn’t change when calling with 1 project so its still not breaking.

fighting a stale bot

I’d love a community contribution here - this has continually gotten pushed back on my priority list unfortunately. Looking at the source provided, there is a change that I’d like made:

Rather than listing all of the dependencies in an array, can we have it as only the root nodes listed? Something like:

export async function ensureComplexNxProject(...inputs: PluginInput[]): void {
  ensureDirSync(tmpProjPath());
  cleanup();
  runNxNewCommand();
  const workspaceLibraryDependencies = collectLibraryDependenciesFromGraph(inputs, await createProjectGraphAsync())
  patchPackageJsonForPlugins(inputs);
  runPackageManagerInstall();
}