Skip to content

Commit

Permalink
docs: emitDecoratorMetadata Documentation for issue 288 (#345)
Browse files Browse the repository at this point in the history
* emitDecoratorMetadata Documentation for issue 288
* Revised to reflect confirmation that the emitDecoratorMetadata is required with Angular 9 (i.e. Angular 8 and higher)
  • Loading branch information
mousedownmike authored Mar 12, 2020
1 parent 1ae55c6 commit 612be29
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ Problems may arise if you're using custom builds (this preset is tailored for `a

### Can't resolve all parameters for SomeClass(?)

This is related to Angular's reflection and also depends on a reflection library, as e. g. included in `core-js`. We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install `core-js` and import the reflection library in your `setupJest.ts`:
With Angular 8 and higher, a [change to the way the Angular CLI works](https://github.com/thymikee/jest-preset-angular/issues/288) may be causing your metadata to be lost. You can update your `tsconfig.spec.json` to include the `emitDecoratorMetadata` compiler option:

```
"compilerOptions": {
"emitDecoratorMetadata": true
```

In general, this is related to Angular's reflection and also depends on a reflection library, as e. g. included in `core-js`. We use our own minimal reflection that satisfy Angular's current requirements, but in case these change, you can install `core-js` and import the reflection library in your `setupJest.ts`:
```typescript
require('core-js/es/reflect');
require('core-js/proposals/reflect-metadata');
Expand Down

0 comments on commit 612be29

Please sign in to comment.