I used the code from following site to test an example with Angular 17 and Jest for unit tests:
https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v17
After running npm test
, everything is fine and the tests are finished without an issue.
Because I have to use the library jsonpath-plus
, I changed the implementation of examplesexample-app-v17srcappapp.component.ts
import { Component } from '@angular/core';
import { RouterLink, RouterOutlet } from '@angular/router';
import { JSONPath } from 'jsonpath-plus';
import { BannerComponent } from './banner/banner.component';
import { WelcomeComponent } from './welcome/welcome.component';
@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.html',
imports: [BannerComponent, WelcomeComponent, RouterOutlet, RouterLink],
})
export class AppComponent {
static check(): any {
const path = `$..*[?(@property === 'className')]^^^`;
const object: any = JSONPath({
path,
json: []
});
return object;
}
}
After starting the test via npm test
, I got the following error:
Also with the given hints, I was not able to fix this issue.
Does anyone have a hint, how I can fix this?
Thank you in advance!
Best regards.