Trying to setup Testing-Library with Angular 18 and Karma
Closed this issue · 2 comments
Hi there,
First of all, thanks for your wonderful testing library.
I'm trying to get angular-testing-library to work on my new Angular project.
Apparently since recently, karma.config file isn't mandatory so I'm not sure if there's something specific I need to add or configure to make the library work correctly.
I had to npm install the package @types/testing-library__jasmine-dom so that my IDE (IntelliJ) could recognize the Jasmine methods.
I edited the configuration in various ways, but each time I run the tests, I get the following error:
TypeError: expect(...).toBeVisible is not a function
or
Property 'toBeVisible' does not exist on type 'Matchers<HTMLElement>'.
I'm currently using:
Angular version: 18.2
Angular Testing Library version: 17.3.1
Karma version: 6.4.0
Jasmine version: 5.2.0
Any insights on this would be greatly appreciated.
here's is the repository
Thanks in advance!
You will have to create a test setup file and add the DOM matchers there.
For an example setup see
@timdeschryver Thank you for your quick reply. It solved the issue.