nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.75k stars 2.37k forks source link

@nx/playwright:configuration doesn't exclude e2e files from unit test config #21274

Open kprekratbob opened 10 months ago

kprekratbob commented 10 months ago

Current Behavior

When generating playwright configuration for existing Angular project via nx g @nx/playwright:configuration, playwright test configuration will be created, but newly added playwright tests (.spec.ts files) will not be excluded from compilation when running nx test for that project.

Expected Behavior

When nx test project is run, tests inside of the e2e folder should not be part of the testing (compilation) scope.

Possible solution:

Create a separate tsconfig file for e2e tests, and exclude e2e folder in tsconfig.spec.ts file.

GitHub Repo

No response

Steps to Reproduce

  1. Open an existing nx repo with at least one Angular project with unit testing set up
  2. Add new playwright test to the repo by running nx g @nx/playwright:configuration --project=project-name
  3. Create one simple test file inside of e2e folder with broken syntax (so it cannot be compiled by compiler)
  4. When running nx test, created file should throw a compile-time error

Nx Report

Node   : 18.10.0
   OS     : darwin-arm64
   npm    : 8.19.2

   nx (global)        : 16.6.0
   nx                 : 16.4.0
   @nx/js             : 16.4.0
   @nx/jest           : 16.4.0
   @nx/linter         : 16.4.0
   @nx/workspace      : 16.4.0
   @nx/angular        : 16.4.0
   @nx/cypress        : 16.4.0
   @nx/devkit         : 16.4.0
   @nx/eslint-plugin  : 16.4.0
   @nx/nest           : 16.4.0
   @nx/node           : 16.4.0
   @nx/plugin         : 16.4.0
   @nx/storybook      : 16.4.0
   @nrwl/tao          : 16.4.0
   @nx/web            : 16.4.0
   @nx/webpack        : 16.4.0
   nx-cloud           : 16.5.2
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @compodoc/compodoc : 1.1.23
   @nx/playwright     : 17.2.6
   @storybook/angular : 7.5.1
   ng-mocks           : 14.11.0
   ngx-library-assets : 1.2.2

Failure Logs

No response

Package Manager Version

16.4.0.

Operating System

Additional Information

No response

Danieliverant commented 10 months ago

On the same note, the same generator adding eslintrc.json config to the base config which includes all the files instead to the block that restricting the files only under /e2e

Current:

image

Expected:

image

Danieliverant commented 9 months ago

any news on that? maybe a workaround to extend the current generator?

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏