nrwl / nx

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

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

Open kprekratbob opened 7 months ago

kprekratbob commented 7 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 7 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 6 months ago

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