I have a component
export class Echart {
private _container: HTMLDivElement;
constructor() {
console.log("Hallo")
}
and set a breakpoint at constructor() but it will never created unless a I add a @customComponent decorator.
@customElement({
name: 'echart'
})
export class Echart {
private _container: HTMLDivElement;
constructor() {
console.log("Hallo")
}
How does your test code look like? Maybe a more complete set of code should help. I would guess you didn’t even use this chart component.
This works here: Aurelia 2 Component Test - StackBlitz but not in my local environment. It the exact same code, but the bound() method never gets called until I add @customElement("echart").
After adding that, bound() gets called, but the ref element remains undefined. Is there something wrong with my Jest environment?
Edit: I need to checkout this locally and check for differences.
It was my outdated jest.config.ts.
I took the jest part of package.json from npx makes aurelia and the test now works as expected.