feat(codemode): support void and Object.is (#37332)

This commit is contained in:
Aiden Cline 2026-07-16 11:15:29 -05:00 committed by GitHub
commit 60c7f847c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 3 deletions

View file

@ -593,6 +593,24 @@ describe("Set", () => {
})
describe("stdlib integration", () => {
test("Object.is uses SameValue semantics", async () => {
expect(
await value(`
const object = {}
return [
Object.is(NaN, NaN),
Object.is(0, -0),
Object.is(object, object),
Object.is({}, {}),
]
`),
).toEqual([true, false, true, false])
})
test("Object.is rejects opaque runtime references", async () => {
expect((await error(`return Object.is(Math.max, Math.max)`)).kind).toBe("InvalidDataValue")
})
test("Object values and entries accept arrays", async () => {
expect(await value(`return [Object.values(["a", "b"]), Object.entries(["a", "b"])]`)).toEqual([
["a", "b"],