Skip to content
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

Doesn't work with Angular 12.2 anymore #76

Closed
rainerhahnekamp opened this issue Oct 26, 2021 · 3 comments · Fixed by #79 or #83
Closed

Doesn't work with Angular 12.2 anymore #76

rainerhahnekamp opened this issue Oct 26, 2021 · 3 comments · Fixed by #79 or #83

Comments

@rainerhahnekamp
Copy link

Describe the bug
When I create a new Angular application and apply the schematics, the tests immediately fail.

Schema validation failed with the following errors:
Data path "/polyfills" must be array.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `ng test`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

To Reproduce
Steps to reproduce the behavior:

npx @angular/cli@12 new angular-cli-jest
npx ng add @briebug/jest-schematic
npm run test

Desktop (please complete the following information):

  • OS: Windows
  • Node version: 14.16.0
  • NPM or Yarn version: NPM 6.14.11
  • App type Angular CLI
  • Angular version 12.2
@spieIbug
Copy link

This problem is linked to angular.json validation
You can fix this by changing the test build configuration
"polyfills": "src/polyfills.ts", -> "polyfills": ["src/polyfills.ts"],
"inlineStyleLanguage": "scss", -> "inlineStyleLanguage": ["scss"],
Here is the test config that should be generated

"test": {
    "builder": "@angular-builders/jest:run",
    "options": {
      "polyfills": ["src/polyfills.ts"],
      "tsConfig": "tsconfig.spec.json",
      "inlineStyleLanguage": ["scss"],
      "assets": [
        "src/favicon.ico",
        "src/assets"
      ],
      "styles": [
        "src/styles.scss"
      ],
      "scripts": []
    }
  }

@inorganik
Copy link

Could this be an issue with the angular jest builder? Not sure where schema validation happens. I also had to change "assets" into an array of strings.

@patou
Copy link
Contributor

patou commented Dec 6, 2021

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

Juste do :

ng add @patoudss/jest-schematic 

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