diff --git a/packages/expect/src/__tests__/asymmetricMatchers.test.ts b/packages/expect/src/__tests__/asymmetricMatchers.test.ts index 843e51b8719c..bb7bae315ce3 100644 --- a/packages/expect/src/__tests__/asymmetricMatchers.test.ts +++ b/packages/expect/src/__tests__/asymmetricMatchers.test.ts @@ -185,6 +185,19 @@ test('ObjectContaining matches', () => { }); }); +test('ObjectContaining recurses into other-realm objects', () => { + const other_realm = new TextEncoder().encodeInto( + 'hello world', + new Uint8Array(100), + ); // returns {read: 11, written: 11} from Node + jestExpect({foo: other_realm}).toEqual({foo: {read: 11, written: 11}}); + jestExpect( + objectContaining({foo: other_realm}).asymmetricMatch({ + foo: {read: 11, written: 11, zed: 11}, + }), + ).toEqual(true); +}); + test('ObjectContaining does not match', () => { [ objectContaining({foo: 'foo'}).asymmetricMatch({bar: 'bar'}),