There seems to be a difference in the way javascript components and typescript components are transpiled when running tests via Jest, causing reactive updates to fail as fields are no longer registered.
Looking into the Jest cache we see that the transformed TS generated by @lwc/jest-transform does not contain a constructor initializing the fields and their registerDecorators differ in that the fields property is missing.
//Transformed JS component
constructor(...args) {
super(...args);
this._label = void 0;
this._value = void 0;
this._width = void 0;
this._prefix = void 0;
this._postfix = void 0;
}
....
(0, _lwc.registerDecorators)(CurrencyInput, {
publicProps: {
label: {
config: 3
},
value: {
config: 3
},
width: {
config: 3
},
prefix: {
config: 3
},
postfix: {
config: 3
}
},
fields: ["_label", "_value", "_width", "_prefix", "_postfix"]
});
//Transformed TS component
(0, _lwc.registerDecorators)(CurrencyInput, {
publicProps: {
label: {
config: 3
},
value: {
config: 3
},
width: {
config: 3
},
prefix: {
config: 3
},
postfix: {
config: 3
}
}
});
The end result is that tests must be synchronous, that is that all property assignment must happen before the component is mounted. This limits the types of scenarios we can test in our unit testing.