nx icon indicating copy to clipboard operation
nx copied to clipboard

Failure upgrading to 15.9.2 and running migrations for jest 29 - update-tests-jest-29

Open asherccohen opened this issue 2 years ago • 18 comments

Current Behavior

projectName does not match if lib is in a nested folder.

node_modules/@nrwl/devkit/src/generators/executor-options-utils.js line 33 projectName is the name of the folder

Uploading image.png…

Expected Behavior

node_modules/@nrwl/devkit/src/generators/executor-options-utils.js line 33 projectName is the name defined in project.json

GitHub Repo

No response

Steps to Reproduce

  1. upgrade an nx workspace to 15.9.2
  2. run migrations

Nx Report

Node : 18.13.0
   OS   : linux x64
   npm  : 8.19.3
   
   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/express           : 15.9.2
   @nrwl/next              : 15.9.2
   @nrwl/node              : 15.9.2
   @nrwl/react             : 15.9.2
   @nrwl/rollup            : 15.9.2
   @nrwl/storybook         : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/web               : 15.9.2
   @nrwl/webpack           : 15.9.2
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @nrwl/remix : 15.9.5

Failure Logs

![Uploading image.png…]()

 >  NX   Failed to run update-tests-jest-29 from @nrwl/jest. This workspace is NOT up to date!


 >  NX   Cannot find configuration for 'api-client'


Error: Cannot find configuration for 'api-client'
    at readProjectConfiguration (/home/cohen/dev/ui-workspace/node_modules/nx/src/generators/utils/project-configuration.js:90:15)
    at /home/cohen/dev/ui-workspace/node_modules/@nrwl/jest/src/migrations/update-15-8-0/update-tests-jest-29.js:13:73
    at forEachProjectConfig (/home/cohen/dev/ui-workspace/node_modules/@nrwl/devkit/src/generators/executor-options-utils.js:41:17)
    at forEachExecutorOptionsInGraph (/home/cohen/dev/ui-workspace/node_modules/@nrwl/devkit/src/generators/executor-options-utils.js:28:5)
    at /home/cohen/dev/ui-workspace/node_modules/@nrwl/jest/src/migrations/update-15-8-0/update-tests-jest-29.js:12:68
    at Generator.next (<anonymous>)
    at fulfilled (/home/cohen/dev/ui-workspace/node_modules/tslib/tslib.js:164:62)
Command failed: npx nx _migrate --run-migrations=migrations.json --legacy-peer-deps --verbose

Additional Information

No response

asherccohen avatar Apr 20 '23 07:04 asherccohen

I have the same issue, im upgrading from angular 13 to 15 image .

jordi72 avatar Apr 20 '23 09:04 jordi72

@asherccohen can you share the project.json of the 'api-client' project before the migration ran?

barbados-clemens avatar Apr 20 '23 13:04 barbados-clemens

@barbados-clemens i can provide info if required, im very interested in fixing this issue, i'll have to upgrade my monorepo soon, and at the moment i can't.

jordi72 avatar Apr 20 '23 14:04 jordi72

@barbados-clemens i've seen that the 'npx nx migrate --run-migrations' fails when it has to change the jest config of the right file of the image, the left one works fine image

jordi72 avatar Apr 20 '23 15:04 jordi72

@jordi72 can you share the full stack trace of the error you're seeing when trying to migrate?

barbados-clemens avatar Apr 20 '23 15:04 barbados-clemens

I cannot share the plain log but i can share a short version. I have to mention that i've changed the structure of the jest file with a module.export to the export default format, and i can pass that point, now in having another error but the same description.

Migration Log

 >  NX   Running migrations from 'migrations.json'


>  NX   NOTE  Use "nx show projects" to read the list of projects.

  If you read the list of projects from angular.json, use "nx show projects" instead.

Ran 15-7-0-split-configuration-into-project-json-files from @nrwl/workspace
  Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.

  UPDATE alot of project.json files
  DELETE angular.json
  UPDATE tsconfig.base.json
---------------------------------------------------------
Ran 14-2-0-add-json-schema from nx
  Add JSON Schema to Nx configuration files

  UPDATE nx.json
  UPDATE alot of project.json files
---------------------------------------------------------
Ran 14-2-0-remove-default-collection from nx
  Remove default collection from configuration to switch to prompts for collection

  UPDATE nx.json
---------------------------------------------------------
Ran 14.3.4-create-target-defaults from nx
  Replace targetDependencies with targetDefaults

  UPDATE nx.json
---------------------------------------------------------
Ran 15.0.0-migrate-to-inputs from nx
  Replace implicitDependencies with namedInputs + target inputs

  UPDATE nx.json
---------------------------------------------------------
Ran 15.0.0-prefix-outputs from nx
  Prefix outputs with {workspaceRoot}/{projectRoot} if needed

    UPDATE alot of project.json files
---------------------------------------------------------
Ran add-eslint-inputs from @nrwl/linter
  Stop hashing eslint config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
Ran add-eslint-ignore from @nrwl/linter
  Add node_modules to root eslint ignore

  CREATE .eslintignore
---------------------------------------------------------
Ran add-cypress-inputs from @nrwl/cypress
  Stop hashing cypress spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
unable to update file because it doesn't exist or is not a js or ts file. Config: libs/jest.config.js. Exists?: false
Ran exclude-jest-config-from-ts-config from @nrwl/jest
  Exclude jest.config.ts from tsconfig where missing.

  UPDATE alot of tsconfig.app.json, tsconfig.spec.json, tsconfig.lib.json, tsconfig.lib.prod.json

---------------------------------------------------------
Ran add-jest-inputs from @nrwl/jest
  Stop hashing jest spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------

>  NX  Jest Snapshot format changed in v29.
By default Nx kept the older style to prevent breaking of existing tests with snapshots.
It's recommend you update to the latest format.
You can do this in your project's jest config file.
Remove the snapshotFormat property and re-run tests with the --update-snapshot flag.
More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format

Ran update-configs-jest-29 from @nrwl/jest
  Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)      

  UPDATE alot of jest.config.ts files
  UPDATE jest.preset.js
---------------------------------------------------------

> [email protected] postinstall
> node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main


 >  NX   Decoration of the Angular CLI is deprecated and will be removed in a future version       

   Please replace usage of "ng <command>" in any scripts, particularly for CI, with "nx <command>" 


 >  NX   Angular CLI has been decorated to enable computation caching.


> [email protected] prepare
> husky install

husky - Git hooks installed

added 14 packages, removed 16 packages, changed 3 packages, and audited 2436 packages in 13s       

357 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
Ran install-required-packages from @nrwl/angular
  Install the required angular-devkit packages as we do not directly depend on them anymore        

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version from @nrwl/angular
  Update the @angular/cli package version.

  UPDATE package.json
---------------------------------------------------------
Ran update-postinstall-script-ngcc-target from @nrwl/angular
  Update postinstall script running ngcc to use ES2020 target.

  UPDATE package.json
---------------------------------------------------------
Ran update-tsconfig-target from @nrwl/angular
  Update TypeScript compilation target to 'ES2020'.

  UPDATE alot of tsconfig.json files
---------------------------------------------------------
Ran update-angular-cli-version-14-1-0 from @nrwl/angular
  Update the @angular/cli package version to ~14.1.0.

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version-14-2-0 from @nrwl/angular
  Update the @angular/cli package version to ~14.2.0.

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version-15-0-0 from @nrwl/angular
  Update the @angular/cli package version to ~15.0.0.

  UPDATE package.json
---------------------------------------------------------
Ran remove-browserlist-config from @nrwl/angular
  Remove browserslist config as it's handled by build-angular

  DELETE alot of .browserslistrc files
---------------------------------------------------------
Ran update-typescript-target from @nrwl/angular
  Update typescript target to ES2022

   UPDATE alot of tsconfig.app.json, tsconfig.spec.json, tsconfig.lib.json, tsconfig.lib.prod.json
---------------------------------------------------------

 >  NX   Failed to run update-platform-server-exports from @nrwl/angular. This workspace is NOT up to date!


 >  NX   rule is not a function

   Pass --verbose to see the stacktrace.

Command failed: npx nx _migrate --run-migrations

 >  NX   Command failed: npx nx migrate --run-migrations

   Pass --verbose to see the stacktrace.

Command failed: C:\Users\computer\AppData\Local\Temp\tmp-15552-rkUeDs6nFxL3\node_modules\.bin\nx _migrate --run-migrations

computer@cumputer MINGW64 ~/Workspace/project-2 (git-branch)
$ npx nx migrate --run-migrations --verbose

 >  NX   Running 'npm install' to make sure necessary packages are installed

npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs       

> [email protected] postinstall
> node ./decorate-angular-cli.js && ngcc --properties es2020 browser module main


 >  NX   Decoration of the Angular CLI is deprecated and will be removed in a future version       

   Please replace usage of "ng <command>" in any scripts, particularly for CI, with "nx <command>" 


 >  NX   Angular CLI has been decorated to enable computation caching.


> [email protected] prepare
> husky install

husky - Git hooks installed

added 72 packages, removed 38 packages, changed 49 packages, and audited 2471 packages in 15s      

357 packages are looking for funding
  run `npm fund` for details

2 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

 >  NX   Running migrations from 'migrations.json'

Ran 15.0.0-migrate-to-inputs from nx
  Replace implicitDependencies with namedInputs + target inputs

  UPDATE nx.json
---------------------------------------------------------
Ran add-eslint-inputs from @nrwl/linter
  Stop hashing eslint config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
unable to update file because it doesn't exist or is not a js or ts file. Config: libs/jest.config.js. Exists?: false
Ran add-jest-inputs from @nrwl/jest
  Stop hashing jest spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------

>  NX  Jest Snapshot format changed in v29.
By default Nx kept the older style to prevent breaking of existing tests with snapshots.
It's recommend you update to the latest format.
You can do this in your project's jest config file.
Remove the snapshotFormat property and re-run tests with the --update-snapshot flag.
More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format


> [email protected] postinstall
> node ./decorate-angular-cli.js && ngcc --properties es2020 browser module main


 >  NX   Decoration of the Angular CLI is deprecated and will be removed in a future version       

   Please replace usage of "ng <command>" in any scripts, particularly for CI, with "nx <command>" 


 >  NX   Angular CLI has been decorated to enable computation caching.


> [email protected] prepare
> husky install

husky - Git hooks installed

removed 1 package, changed 1 package, and audited 2471 packages in 8s

357 packages are looking for funding
  run `npm fund` for details

2 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
Ran update-angular-cli-version from @nrwl/angular
  Update the @angular/cli package version.

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version-14-1-0 from @nrwl/angular
  Update the @angular/cli package version to ~14.1.0.

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version-14-2-0 from @nrwl/angular
  Update the @angular/cli package version to ~14.2.0.

  UPDATE package.json
---------------------------------------------------------
Ran update-angular-cli-version-15-0-0 from @nrwl/angular
  Update the @angular/cli package version to ~15.0.0.
    at MergeMapSubscriber.Subscriber.next (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Subscriber.js:66:18)
    at Observable._subscribe (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
    at Observable._trySubscribe (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:30:22)
    at MergeMapOperator.call (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\mergeMap.js:37:23)
    at Observable.subscribe (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31)
    at MapOperator.call (C:\Users\myuser\Workspace\project-2\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\map.js:32:23)
Command failed: npx nx _migrate --run-migrations --verbose

 >  NX   Command failed: npx nx migrate --run-migrations --verbose

Error: Command failed: npx nx migrate --run-migrations --verbose
    at checkExecSyncError (node:child_process:828:11)    at execSync (node:child_process:902:15)
    at runNxSync (C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\nx\src\utils\child-process.js:26:34)
    at C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\nx\src\command-line\migrate.js:935:43
    at Generator.next (<anonymous>)    at C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\tslib\tslib.js:167:75    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\tslib\tslib.js:163:16)
    at runMigrations (C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\nx\src\command-line\migrate.js:928:20)
    at Object.<anonymous> (C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\nx\src\command-line\migrate.js:1046:23)
Command failed: C:\Users\computer\AppData\Local\Temp\tmp-1932-lHi9znA7EJSA\node_modules\.bin\nx _migrate --run-migrations --verbose

Might be probably because angular/cli is not in version 15?

jordi72 avatar Apr 20 '23 16:04 jordi72

@jordi72 The log you provided looks like a separte issue: https://github.com/nrwl/nx/issues/16161

do you have the stack trace from the time you saw this error?

(I also edited your comment to make it more readable.)

barbados-clemens avatar Apr 20 '23 16:04 barbados-clemens

I am also receiving this same error when upgrading to 15.9.2

 >  NX   Running migrations from 'migrations.json'

Ran 15.0.0-migrate-to-inputs from nx
  Replace implicitDependencies with namedInputs + target inputs

  UPDATE nx.json
---------------------------------------------------------
Ran add-eslint-inputs from @nrwl/linter
  Stop hashing eslint config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
Ran add-jest-inputs from @nrwl/jest
  Stop hashing jest spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------

>  NX  Jest Snapshot format changed in v29.
By default Nx kept the older style to prevent breaking of existing tests with snapshots.
It's recommend you update to the latest format.
You can do this in your project's jest config file.
Remove the snapshotFormat property and re-run tests with the --update-snapshot flag.
More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format


 >  NX   Failed to run update-tests-jest-29 from @nrwl/jest. This workspace is NOT up to date!

if I remove these migrations it works obviously due to not doing the jest migration

    // {
    //   "version": "15.8.0-beta.0",
    //   "cli": "nx",
    //   "description": "Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
    //   "factory": "./src/migrations/update-15-8-0/update-configs-jest-29",
    //   "package": "@nrwl/jest",
    //   "name": "update-configs-jest-29"
    // },
    // {
    //   "version": "15.8.0-beta.0",
    //   "cli": "nx",
    //   "description": "Update jest test files to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
    //   "factory": "./src/migrations/update-15-8-0/update-tests-jest-29",
    //   "package": "@nrwl/jest",
    //   "name": "update-tests-jest-29"
    // },

jberrydev avatar Apr 21 '23 00:04 jberrydev

@jberrydev can you rerun the migration with the --verbose flag to get the stacktrace?

barbados-clemens avatar Apr 21 '23 13:04 barbados-clemens

@barbados-clemens here is my original terminal log, sorry for the delay.

Logs
$ npx nx migrate --run-migrations --verbose

 >  NX   Running 'npm install' to make sure necessary packages are installed


> [email protected] postinstall
> node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main

Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.

> [email protected] prepare
> husky install

husky - Git hooks installed

removed 7 packages, changed 1 package, and audited 2437 packages in 6s

357 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

 >  NX   Running migrations from 'migrations.json'


>  NX   NOTE  Use "nx show projects" to read the list of projects.

  If you read the list of projects from angular.json, use "nx show projects" instead.

Ran 15-7-0-split-configuration-into-project-json-files from @nrwl/workspace
  Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.

  UPDATE some of project.json
  DELETE angular.json
  UPDATE tsconfig.base.json
---------------------------------------------------------
Ran 14-2-0-add-json-schema from nx
  Add JSON Schema to Nx configuration files

  UPDATE nx.json
  UPDATE more project.json
---------------------------------------------------------
Ran 14-2-0-remove-default-collection from nx
  Remove default collection from configuration to switch to prompts for collection

  UPDATE nx.json
---------------------------------------------------------
Ran 14.3.4-create-target-defaults from nx
  Replace targetDependencies with targetDefaults

  UPDATE nx.json
---------------------------------------------------------
Ran 15.0.0-migrate-to-inputs from nx
  Replace implicitDependencies with namedInputs + target inputs

  UPDATE nx.json
---------------------------------------------------------
Ran 15.0.0-prefix-outputs from nx
  Prefix outputs with {workspaceRoot}/{projectRoot} if needed

  UPDATE apps/Project/project.json
  UPDATE mooore project.json
---------------------------------------------------------
Ran add-eslint-inputs from @nrwl/linter
  Stop hashing eslint config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
Ran add-eslint-ignore from @nrwl/linter
  Add node_modules to root eslint ignore

  CREATE .eslintignore
---------------------------------------------------------
Ran add-cypress-inputs from @nrwl/cypress
  Stop hashing cypress spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------
unable to update file because it doesn't exist or is not a js or ts file. Config: libs/jest.config.js. Exists?: false
Ran exclude-jest-config-from-ts-config from @nrwl/jest
  Exclude jest.config.ts from tsconfig where missing.

   UPDATE tsconfig files
---------------------------------------------------------
Ran add-jest-inputs from @nrwl/jest
  Stop hashing jest spec files and config files for build targets and dependent tasks

  UPDATE nx.json
---------------------------------------------------------

>  NX  Jest Snapshot format changed in v29.
By default Nx kept the older style to prevent breaking of existing tests with snapshots.
It's recommend you update to the latest format.
You can do this in your project's jest config file.
Remove the snapshotFormat property and re-run tests with the --update-snapshot flag.
More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format

Ran update-configs-jest-29 from @nrwl/jest
  Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)      

  UPDATE jest.config.ts files
  UPDATE jest.preset.js
---------------------------------------------------------

 >  NX   Failed to run update-tests-jest-29 from @nrwl/jest. This workspace is NOT up to date!     


 >  NX   Cannot find configuration for 'delivery-notes-feature-list' //My comment: <--- The file with the export.module syntax 


Error: Cannot find configuration for 'delivery-notes-feature-list'
    at readProjectConfiguration (C:\Users\myuser\Workspace\Project-2\node_modules\nx\src\generators\utils\project-configuration.js:90:15)
    at C:\Users\myuser\Workspace\Project-2\node_modules\@nrwl\jest\src\migrations\update-15-8-0\update-tests-jest-29.js:13:73
    at forEachProjectConfig (C:\Users\myuser\Workspace\Project-2\node_modules\@nrwl\devkit\src\generators\executor-options-utils.js:38:17)
    at forEachExecutorOptionsInGraph (C:\Users\myuser\Workspace\Project-2\node_modules\@nrwl\devkit\src\generators\executor-options-utils.js:28:5)
    at C:\Users\myuser\Workspace\Project-2\node_modules\@nrwl\jest\src\migrations\update-15-8-0\update-tests-jest-29.js:12:68
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\myuser\Workspace\Project-2\node_modules\tslib\tslib.js:164:62)
Command failed: npx nx _migrate --run-migrations --verbose

 >  NX   Command failed: npx nx migrate --run-migrations --verbose


Error: Command failed: npx nx migrate --run-migrations --verbose
    at checkExecSyncError (node:child_process:828:11)
    at execSync (node:child_process:902:15)
    at runNxSync (C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\nx\src\utils\child-process.js:26:34)
    at C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\nx\src\command-line\migrate.js:935:43
    at Generator.next (<anonymous>)
    at C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\tslib\tslib.js:167:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\tslib\tslib.js:163:16)
    at runMigrations (C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\nx\src\command-line\migrate.js:928:20)
    at Object.<anonymous> (C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\nx\src\command-line\migrate.js:1046:23)
Command failed: C:\Users\MYUSER~1\AppData\Local\Temp\tmp-8436-zUiCKvX7ZDig\node_modules\.bin\nx _migrate --run-migrations --verbose

jordi72 avatar Apr 24 '23 07:04 jordi72

@jordi72 can you share the project.json before the migration of the delivery-notes-feature-list project and the project level jest config, this is right next to the project.json and is located in the @nrwl/jest:jest executor option like

"test": {
  "executor": "@nrwl/jest:jest",
  "options": {
    "jestConfig": "path/to/project/jest.config.ts"
  }
}

(I've also edited your comment to make it more readable with the long logs)

barbados-clemens avatar Apr 24 '23 14:04 barbados-clemens

project.json (of delivery-notes-feature-list)

{
  "projectType": "library",
  "root": "libs/delivery-notes/feature-list",
  "sourceRoot": "libs/delivery-notes/feature-list/src",
  "prefix": "delivery-notes",
  "targets": {
    "build": {
      "executor": "@nrwl/angular:ng-packagr-lite",
      "outputs": ["dist/libs/delivery-notes/feature-list"],
      "options": {
        "project": "libs/delivery-notes/feature-list/ng-package.json"
      },
      "configurations": {
        "production": {
          "tsConfig": "libs/delivery-notes/feature-list/tsconfig.lib.prod.json"
        },
        "development": {
          "tsConfig": "libs/delivery-notes/feature-list/tsconfig.lib.json"
        }
      },
      "defaultConfiguration": "production"
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["coverage/libs/delivery-notes/feature-list"],
      "options": {
        "jestConfig": "libs/delivery-notes/feature-list/jest.config.js",
        "passWithNoTests": true
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "options": {
        "lintFilePatterns": [
          "libs/delivery-notes/feature-list/src/**/*.ts",
          "libs/delivery-notes/feature-list/src/**/*.html"
        ]
      }
    }
  },
  "tags": ["domain:delivery-notes", "type:feature"]
}

jest.config.js (of delivery-notes-feature-list) (not sure if your asking for this file)

module.exports = {
  displayName: 'distributors-feature-components',
  preset: '../../../jest.preset.js',
  setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
  globals: {
    'ts-jest': {
      tsconfig: '<rootDir>/tsconfig.spec.json',
      stringifyContentPathRegex: '\\.(html|svg)$',
    },
  },
  coverageDirectory: '../../../coverage/libs/distributors/feature-components',
  transform: {
    '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
  },
  transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
  snapshotSerializers: [
    'jest-preset-angular/build/serializers/no-ng-attributes',
    'jest-preset-angular/build/serializers/ng-snapshot',
    'jest-preset-angular/build/serializers/html-comment',
  ],
};

jordi72 avatar Apr 24 '23 14:04 jordi72

@jordi72 what version of Nx were you migrating from?

barbados-clemens avatar Apr 24 '23 16:04 barbados-clemens

@barbados-clemens 14.1.9

jordi72 avatar Apr 24 '23 19:04 jordi72

@jordi72 @jberrydev can y'all try migrating to the latest major version of nx you're on first. i.e. nx migrate [email protected] then doing nx migrate lastest to get to the latest version of v15.

there was a lot of changes in the project inferences that happened between v14-v15 and being on an earily version of v14 I wonder if there is an issue where things are getting cross as you're migrating across almost two whole nx versions. all of v14 and all of v15 at once.

another thing is if it's a single troubled project you could try adding the 'name' property in the project.json just so Nx doesn't try to infer the name.

barbados-clemens avatar Apr 25 '23 21:04 barbados-clemens

@barbados-clemens im getting this error #16161 image This issue is fixed in any 16 version? will there be any 15.9.3 with some updates? is there any workaround? The issue of jest looks solved by updating first to 14.8.8 (latest of 14) and then go to latest (15 at this moment)

jordi72 avatar Apr 26 '23 07:04 jordi72

@jordi72 that looks like this issue https://github.com/nrwl/nx/issues/16161 which looks to be resolved.

@jberrydev and @asherccohen can you confirm upgraded to the latest of your current nx major version first before trying to jump to the next major solves the issue for you?

i.e. if you're on nx 13 currently

# migrate to latest v13 first
nx migrate 13.10.5
nx migrate --run-migrations # if there were migrations.json to run

# then to latest v14
nx migrate 14.8.8
nx migrate --run-migrations

# finally 
nx migrate latest
nx migrate --run-migrations

barbados-clemens avatar Apr 26 '23 13:04 barbados-clemens

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Jun 16 '23 00:06 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Jul 31 '23 00:07 github-actions[bot]