nrwl/nx

Nx Loads "jest.config.ts" when "npx nx format:write --files" command is run

Opened this issue · 0 comments

Current Behavior

I have a pre-commit hook that runs npx nx format:write --files.
I am encountering an exception that is coming from the jest.config.ts in a nestjs project.
I can fix the exception, but I think jest.config.ts is being loaded when a task that is not related in anyway to the test is invoked

Please help me undertand this.

Thanks

Expected Behavior

I believe the jest.config.ts should not be loaded when running npx nx format:write --files task

GitHub Repo

No response

Steps to Reproduce

  1. run npx nx format:write --files in debug mode
  2. Put a breakpoint in the first line of jest.config.ts or throw an error
  3. See that the breakpoint is hit

Nx Report

Node           : 22.9.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.9.0

nx                 : 20.2.1
@nx/js             : 20.2.1
@nx/jest           : 20.2.1
@nx/eslint         : 20.2.1
@nx/workspace      : 20.2.1
@nx/angular        : 20.2.1
@nx/cypress        : 20.2.1
@nx/devkit         : 20.2.1
@nx/esbuild        : 20.2.1
@nx/eslint-plugin  : 20.2.1
@nx/express        : 20.2.1
@nx/nest           : 20.2.1
@nx/node           : 20.2.1
@nx/storybook      : 20.2.1
@nx/web            : 20.2.1
@nx/webpack        : 20.2.1
typescript         : 5.3.3
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/storybook/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc : 1.1.26
@storybook/angular : 8.4.7

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

No response