briebug/jest-schematic

Angular 13 - NOT SUPPORTED: keyword "id", use "$id" for schema ID

mmonteiroc opened this issue ยท 6 comments

Describe the bug
Trying to run ng add @briebug/jest-schematic
Get the following error

ng add @briebug/jest-schematic
An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
See "C:\Users\montei0m\AppData\Local\Temp\ng-p0TjR2\angular-errors.log" for further details.

SAME ISSUE WITH THE GLOBALLY INSTALLED
To Reproduce
Steps to reproduce the behavior:
image

Expected behavior
That works as in the gif of your readme file
image

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Mac, Windows] Windows
  • Node version: [e.g. 8.11.3] 14.17.3
  • NPM or Yarn version [e.g. Yarn 1.3.0] NPM 6.14.7
  • App type [e.g. Angular CLI, Nx Workspace]
  • Angular version [e.g. @angular/core: "6.0.3"]
 ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / โ–ณ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 13.0.1
Node: 14.17.3
Package Manager: npm 6.14.7
OS: win32 x64

Angular: 13.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.1
@angular-devkit/build-angular   13.0.1
@angular-devkit/core            13.0.1
@angular-devkit/schematics      13.0.1
@angular/cli                    13.0.1
@schematics/angular             13.0.1
rxjs                            7.4.0
typescript                      4.4.4

Additional context
Add any other context about the problem here.

CONFIRMED WITH ANGULAR 12 WORKS

I reproduce this issue on new project (generated by ng new), with angular@13.0.0

patou commented

I created a PR #79 to correct all issues with angular 13.

Got the same problem:


The package @briebug/jest-schematic@3.1.0 will be installed and executed.
Would you like to proceed? Yes
โœ” Package successfully installed.
An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
See "/private/var/folders/d3/1n3l12yn5nx_42xffkx5yvlw0000gn/T/ng-VydCyo/angular-errors.log" for further details.
patou commented

I publish the correction on a new package npm :
https://www.npmjs.com/package/@patoudss/jest-schematic

Juste do :

ng add @patoudss/jest-schematic 

This works! @patou THANKS!!

The only thing is that for library projects, I get this error:

โ— Validation Error:
  Module ts-jest in the transform option was not found.

Which can be fixed by just installing ts-jest:

npm i -D ts-jest

I now noticed that ts-jest is having issues with importing from angular package format library dependencies:

https://stackoverflow.com/questions/70326350/jest-encountered-an-unexpected-token-error-when-using-ts-jest

Anyone else seeing this?