diff --git a/src/bun.js/bindings/JSPropertyIterator.cpp b/src/bun.js/bindings/JSPropertyIterator.cpp index 89e64a8ac88121..c7e3ae8fed8589 100644 --- a/src/bun.js/bindings/JSPropertyIterator.cpp +++ b/src/bun.js/bindings/JSPropertyIterator.cpp @@ -45,6 +45,10 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje auto scope = DECLARE_THROW_SCOPE(vm); JSC::PropertyNameArray array(vm, PropertyNameMode::StringsAndSymbols, PrivateSymbolMode::Exclude); + if (UNLIKELY(object->hasNonReifiedStaticProperties())) { + object->reifyAllStaticProperties(globalObject); + } + #if OS(WINDOWS) if (UNLIKELY(object->type() == JSC::ProxyObjectType)) { // Check if we're actually iterating through the JSEnvironmentVariableMap's proxy. @@ -75,7 +79,7 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje if (only_non_index_properties) { object->getOwnNonIndexPropertyNames(globalObject, array, DontEnumPropertiesMode::Exclude); } else { - object->getOwnPropertyNames(object, globalObject, array, DontEnumPropertiesMode::Exclude); + object->methodTable()->getOwnPropertyNames(object, globalObject, array, DontEnumPropertiesMode::Exclude); } } else { object->getPropertyNames(globalObject, array, DontEnumPropertiesMode::Exclude); @@ -161,7 +165,7 @@ extern "C" EncodedJSValue Bun__JSPropertyIterator__getNameAndValue(JSPropertyIte auto& vm = iter->vm; auto scope = DECLARE_THROW_SCOPE(vm); PropertySlot slot(object, PropertySlot::InternalMethodType::GetOwnProperty); - if (!object->getOwnPropertySlot(object, globalObject, prop, slot)) { + if (!object->methodTable()->getOwnPropertySlot(object, globalObject, prop, slot)) { return {}; } RETURN_IF_EXCEPTION(scope, {}); diff --git a/test/bun.lockb b/test/bun.lockb index fb2b70b1f29064..2d9775c983b086 100755 Binary files a/test/bun.lockb and b/test/bun.lockb differ diff --git a/test/package.json b/test/package.json index 9c9d51d496c4a6..edc248dadfa608 100644 --- a/test/package.json +++ b/test/package.json @@ -20,6 +20,8 @@ "@remix-run/serve": "2.10.3", "@resvg/resvg-js": "2.4.1", "@swc/core": "1.3.38", + "@testing-library/jest-dom": "6.6.3", + "@testing-library/react": "16.1.0", "aws-cdk-lib": "2.148.0", "axios": "1.6.8", "body-parser": "1.20.2", diff --git a/test/regression/issue/16312.test.ts b/test/regression/issue/16312.test.ts new file mode 100644 index 00000000000000..15b9019c0d17e4 --- /dev/null +++ b/test/regression/issue/16312.test.ts @@ -0,0 +1,13 @@ +import { test, afterEach, expect } from "bun:test"; +import { cleanup } from "@testing-library/react"; +import * as matchers from "@testing-library/jest-dom/matchers"; + +expect.extend(matchers); +afterEach(() => { + cleanup(); +}); + +test("expect extended", () => { + // @ts-ignore + expect(expect.toBeInTheDocument).not.toBe(undefined); +});