angular-extensions / pretty-html-log

A module that allows you to pretty print the inner HTML of ComponentFixtures, DebugElements, NativeElements or even plain HTML strings to the console. This is very useful for debugging Angular component tests in Jest
MIT License
38 stars 1 forks source link

Property 'logNgHTML' does not exist on type 'Console'. #3

Closed learnitmyway closed 4 years ago

learnitmyway commented 4 years ago
Test suite failed to run

    TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
    src/app/app.component.test.ts:17:13 - error TS2339: Property 'logNgHTML' does not exist on type 'Console'.

    17     console.logNgHTML(fixture);

In setupJest.ts I have:

import 'jest-preset-angular';
import '@angular-extensions/pretty-html-log';
nivekcode commented 4 years ago

Hi @DeveloperDavo how do you run your tests, over some IDEA or just from command line?

learnitmyway commented 4 years ago

From the command line

On Thu, 13 Feb 2020, 20:21 Kevin Kreuzer, notifications@github.com wrote:

Hi @DeveloperDavo https://github.com/DeveloperDavo how do you run your tests, over some IDEA or just from command line?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular-extensions/pretty-html-log/issues/3?email_source=notifications&email_token=AC33EDVADR5IOUH5TCABNCLRCVVI3A5CNFSM4KTW5JHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELVRTHI#issuecomment-585832861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC33EDQED3DSUGSKISEML23RCVVI3ANCNFSM4KTW5JHA .

nivekcode commented 4 years ago

@DeveloperDavo, unfortunately, I can not reproduce this. I just tried out the library in a new project with Jest. Is there a link to a repo for reproduction?

tonivj5 commented 4 years ago

It works perfect to me too :+1:

learnitmyway commented 4 years ago

Ok I'll have another look during the week. Thanks for checking it out.

On Sat, 22 Feb 2020, 22:07 Kevin Kreuzer, notifications@github.com wrote:

@DeveloperDavo https://github.com/DeveloperDavo, unfortunately, I can not reproduce this. I just tried out the library in a new project with Jest. Is there a link to a repo for reproduction?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular-extensions/pretty-html-log/issues/3?email_source=notifications&email_token=AC33EDU3C66KJA7EWKNOFSLREGHYXA5CNFSM4KTW5JHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVKRRA#issuecomment-589998276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC33EDWRA7VBCHD7WAN5SP3REGHYXANCNFSM4KTW5JHA .

tonivj5 commented 4 years ago

Try adding your setupJest.ts to your tsconfig.spec.ts. I have it so:

// file src/tsconfig.spec.ts. My baseUrl is ./src, so I have to point to ../jest.setup.ts (out of src)
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/spec",
    "types": ["jest", "node"],
    "esModuleInterop": true
  },
  "files": ["polyfills.ts", "../jest.setup.ts"],
  "include": ["**/*.spec.ts", "**/*.d.ts"]
}
learnitmyway commented 4 years ago

@tonivj5, that solved it thanks!