Skip to content

@nx/jest cannot include test files #31353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 4 tasks
its-dibo opened this issue May 27, 2025 · 0 comments
Open
1 of 4 tasks

@nx/jest cannot include test files #31353

its-dibo opened this issue May 27, 2025 · 0 comments

Comments

@its-dibo
Copy link

its-dibo commented May 27, 2025

Current Behavior

nx.json

{
      "plugin": "@nx/jest/plugin",
      "include": ["**/e2e/**/*", "**/*.e2e.spec.ts"], //<-- not working
      "options": {
        "targetName": "e2e",
        "ciTargetName": "e2e-ci",
        "disableJestRuntime": false
      }
    }

when running nx graph the target "e2e" is not shown, even if there are many .e2e.spec.ts files in the project, but when replacing "/*.e2e.spec.ts" with just "/.ts" it works
Also "**/
.spec.ts" doesn't work

the same for the exclude[] property as adding "**/*.e2e.spec.ts" doesn't prevent running e2e files

 {
      "plugin": "@nx/jest/plugin",
      "exclude": ["**/e2e/**/*", "**/*.e2e.spec.ts"], //<-- *.e2e.spec.ts files will run
      "options": {
        "targetName": "unit-test"
      }
    },

Expected Behavior

The e2e target should be shown in nx graph when including 2e2 files

GitHub Repo

No response

Steps to Reproduce

  1. add @nx/jest
  2. in e2e part, include "**/*.e2e.spec.ts"
  3. run nx graph -> the e2e target is not displayed
  4. add "**/*.spec.ts" -> same
  5. add "**/*.ts" -> now e2e is displayed in the task graph

Nx Report

Node           : 22.12.0
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 9.15.0

nx (global)  : 21.1.2
nx           : 21.1.2
@nx/js       : 21.1.2
@nx/jest     : 21.1.2
@nx/eslint   : 21.1.2
typescript   : 5.8.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/jest/plugin
@nx/jest/plugin
---------------------------------------
Cache Usage: 7.89 MB / 46.73 GB

Failure Logs

Package Manager Version

pnpm v9.15.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant