Object.assign not working properly
@swc-node/jest behaves differently with jest 27.5.1.
As of yesterday when I updated jest, I'm getting some weird behavior from swc-node that is causing most of my unit tests to break. Object.assign is no longer working properly with this library.
The exact thing that is newly failing is the following (simplified for example):
export class Base<T> {
constructor(props: Partial<T> = {}) {
Object.assign(this, props);
}
}
export class SomeClass extends Base<SomeClass> {
a: string;
b: boolean;
c: number;
d: string;
}
Expected:
const test = new SomeClass({ a: 'hello', b: false })
// test -> { a: 'hello', b: 'false' }
Actual:
const test = new SomeClass({ a: 'hello', b: false })
// test -> { a: undefined, b: undefined, c: undefined, d: undefined }
Note that our code works fine with ts-jest while using the new jest version.
NPM Version: 8.3.2
Node Version: 16.10.0
@swc-node/core version: 1.8.2
@swc-node/jest version: 1.4.3
jest version: 27.5.1
Is there any update on this?
I can confirm this issue still exists with the following versions:
NPM Version: 8.11.0
Node Version: 16.15.1
@swc-node/core version: 1.9.0
@swc-node/jest version: 1.5.2
jest version: 28.1.1