ernie-research/MEnvData-SWE huggingface dataset:
Repository: denoland/std (TypeScript)

Issue:
std/flags: Using `collect` and `default` together results in a nested array
**Describe the bug**

When setting a default value of a collectable option, it creates a nested array (I'm assuming that as a bug, because the typing says it sould be just `string[]`)

**Steps to Reproduce**

1. Create a script with the contents

```typescript
const test = parse([], {
  string: ["one", "two"],
  collect: ["one"],
  default: {
    one: ["peep", "poop"],
    two: ["why not?"],
  },
});

console.log("test", test);
```

2. Execute the script
3. The output is `test { _: [], one: [ [ "peep", "poop" ] ], two: [ "why not?" ] }`
4. Notice that `one` is a nested array and get confused

<!--
Example
1. Create a file with the contents ...
5. Create a script with the contents ...
6. Execute the command ...
7. See error
-->

**Expected behavior**

I was expecting `one` not to be a nested array. I would expect `test { _: [], one: [ "peep", "poop" ], two: [ "why not?" ] }`

**Environment**

<!-- please complete the following information -->

- OS: ArchLinux
- deno version: 1.33.0 (release, x86_64-unknown-linux-gnu)
- std version: 0.184.0 — 0.187.0



Discussion:

Patch:
diff --git a/flags/mod.ts b/flags/mod.ts
index ab94854ed431..e76e2064fe40 100644
--- a/flags/mod.ts
+++ b/flags/mod.ts
@@ -739,11 +739,11 @@ export function parse<
 
   for (const [key, value] of Object.entries(defaults)) {
     if (!hasKey(argv, key.split("."))) {
-      setKey(argv, key, value);
+      setKey(argv, key, value, false);
 
       if (aliases[key]) {
         for (const x of aliases[key]) {
-          setKey(argv, x, value);
+          setKey(argv, x, value, false);
         }
       }
     }


Test patch:
diff --git a/flags/test.ts b/flags/test.ts
index 425044daad0d..7e01876bb590 100644
--- a/flags/test.ts
+++ b/flags/test.ts
@@ -794,6 +794,20 @@ Deno.test("collectArgsDefaultBehaviour", function () {
   });
 });
 
+Deno.test("collectArgsWithDefaultBehaviour", function () {
+  const argv = parse([], {
+    collect: ["foo"],
+    default: {
+      foo: ["bar", "baz"],
+    },
+  });
+
+  assertEquals(argv, {
+    foo: ["bar", "baz"],
+    _: [],
+  });
+});
+
 Deno.test("collectUnknownArgs", function () {
   const argv = parse([
     "--foo",
Repository: denoland/std (TypeScript)

Issue:
`BidirectionalMap` constructor arg type is unnecessarily strict
**Describe the bug**

The built-in `Map` constructor takes `Iterable<readonly [K, V]>`, whereas the `BidirectionalMap` constructor only allows `readonly (readonly [K, V])[]`, which is unnecessarily strict.

At runtime, `Iterable<readonly [K, V]>` already works fine, however.

**Steps to Reproduce**

```ts
import { BidirectionalMap } from '@std/data-structures/unstable-bidirectional-map'
import { assertEquals } from '@std/assert/equals'

// type OK, resulting type is `Map<number, string>`
new Map(['zero', 'one', 'two'].entries())
// type OK, resulting type is `BidirectionalMap<number, string>`
const bidiFromArr = new BidirectionalMap([...['zero', 'one', 'two'].entries()])
// TS error: Argument of type 'ArrayIterator<[number, string]>' is not assignable to parameter of type 'readonly (readonly [unknown, unknown])[]'.
// Resulting type is `BidirectionalMap<unknown, unknown>`
const bidiFromIter = new BidirectionalMap(['zero', 'one', 'two'].entries())

// runtime behavior works correctly, though
assertEquals(bidiFromArr, bidiFromIter)
```

**Expected behavior**

`Iterable<readonly [K, V]>` constructor input is allowed.

**Environment**

@std/data-structures@1.0.6


Discussion:

Patch:
diff --git a/data_structures/unstable_bidirectional_map.ts b/data_structures/unstable_bidirectional_map.ts
index de29bbde8c84..cd0b1d36d0b5 100644
--- a/data_structures/unstable_bidirectional_map.ts
+++ b/data_structures/unstable_bidirectional_map.ts
@@ -45,7 +45,7 @@ export class BidirectionalMap<K, V> extends Map<K, V> {
    *
    * @param entries An iterable of key-value pairs for the initial entries.
    */
-  constructor(entries?: readonly (readonly [K, V])[] | null) {
+  constructor(entries?: Iterable<readonly [K, V]> | null) {
     super();
     this.#reverseMap = new Map<V, K>();
     if (entries) {


Test patch:
diff --git a/data_structures/unstable_bidirectional_map_test.ts b/data_structures/unstable_bidirectional_map_test.ts
index 07618c1e738e..fcc9d4b57f68 100644
--- a/data_structures/unstable_bidirectional_map_test.ts
+++ b/data_structures/unstable_bidirectional_map_test.ts
@@ -312,3 +312,14 @@ Deno.test(
     assertEquals(entries, [[{ name: "Tūī" }, { favourite: true }]]);
   },
 );
+
+Deno.test(
+  "BidirectionalMap constructor accepts iterables of key-value pairs",
+  () => {
+    const bidiFromArr = new BidirectionalMap([
+      ...["zero", "one", "two"].entries(),
+    ]);
+    const bidiFromIter = new BidirectionalMap(["zero", "one", "two"].entries());
+    assertEquals(bidiFromArr, bidiFromIter);
+  },
+);
Repository: typestack/class-validator (TypeScript)

Issue:
fix: base64 options doesn't apply
### Description
By passing `{ urlSafe: true }` to `@IsBase64`, it is supposed to validate base64url correctly, but it doesn’t seem to work properly.


**Minimal code-snippet showcasing the problem**
```ts
export class Base64Test {
  @IsBase64({ urlSafe: true })
  base64: string;

  static from(base64: string): Base64Test {
    return plainToInstance(Base64Test, { base64 });
  }
}

const obj = Base64Test.from("dGVzdA");
const errors = await validate(obj);

if (errors.length > 0) {
  console.log("Failed to validate")
} else {
  console.log("Successfully validated")
}
```

### Expected behavior
It should log `Successfully validated`

### Actual behavior
It logs `Failed to validate`



Discussion:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.



Patch:
diff --git a/src/decorator/string/IsBase64.ts b/src/decorator/string/IsBase64.ts
index 2c5cd3e5be..c59a97009b 100644
--- a/src/decorator/string/IsBase64.ts
+++ b/src/decorator/string/IsBase64.ts
@@ -26,7 +26,7 @@ export function IsBase64(
       name: IS_BASE64,
       constraints: [options],
       validator: {
-        validate: (value, args): boolean => isBase64(value),
+        validate: (value, args): boolean => isBase64(value, options),
         defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be base64 encoded', validationOptions),
       },
     },


Test patch:
diff --git a/test/functional/validation-functions-and-decorators.spec.ts b/test/functional/validation-functions-and-decorators.spec.ts
index 78ceddcd6d..9f938616c4 100644
--- a/test/functional/validation-functions-and-decorators.spec.ts
+++ b/test/functional/validation-functions-and-decorators.spec.ts
@@ -1658,17 +1658,27 @@ describe('IsBase64', () => {
   const validValues = ['aGVsbG8='];
   const invalidValues = [null, undefined, 'hell*mynameisalex'];
 
+  const validBase64UrlValues = ['dGVzdA', 'dGV_zdA'];
+  const invalidBase64UrlValues = [null, undefined, 'dGVzdA=', 'MTIzNDU2Nzg5!!', 'SGVsbG8+V29ybGQ='];
+
   class MyClass {
     @IsBase64()
     someProperty: string;
   }
 
-  it('should not fail if validator.validate said that its valid', () => {
-    return checkValidValues(new MyClass(), validValues);
+  class MyClassWithConstraint {
+    @IsBase64({ urlSafe: true })
+    someProperty: string;
+  }
+
+  it('should not fail if validator.validate said that its valid', async () => {
+    await checkValidValues(new MyClass(), validValues);
+    await checkValidValues(new MyClassWithConstraint(), validBase64UrlValues);
   });
 
-  it('should fail if validator.validate said that its invalid', () => {
-    return checkInvalidValues(new MyClass(), invalidValues);
+  it('should fail if validator.validate said that its invalid', async () => {
+    await checkInvalidValues(new MyClass(), invalidValues);
+    await checkInvalidValues(new MyClassWithConstraint(), invalidBase64UrlValues);
   });
 
   it('should not fail if method in validator said that its valid', () => {
Repository: floating-ui/floating-ui (TypeScript)

Issue:
[React] useHover floating element unexpectedly appears after the reference element is removed from the DOM
**Describe the bug**
useHover floating element unexpectedly appears after the reference element is removed from the DOM.  

**To Reproduce**
https://stackblitz.com/edit/stackblitz-starters-ynswwy

Steps to reproduce the behavior:
1. Go to linked StackBlitz
2. Enter text into input element
3. Observe a new X reference element has appeared to the right of the input element
4. Click the X reference element before the hover timeout completes
5. Observe a floating element (tooltip) appears unexpectedly

**Expected behavior**
I expect removing the reference element from the DOM to prevent the floating element to appear.

Alternatively, I expect the useHover hook to return an Api which allows you to clear the timeout yourself (which is preferable to me...)

**Context:**
 - OS: Manjaro Linux
 - Browser: Chromium
 - Version: 115.0.5790.98
 
 **Additional context**
 The only workaround is a onOpenChange function which checks if the element still exists.


Discussion:
> The only workaround is a onOpenChange function which checks if the element still exists.

`useDismiss` `referencePress: true` option is another workaround



Patch:
diff --git a/packages/react/src/hooks/useHover.ts b/packages/react/src/hooks/useHover.ts
index 5ce1f080b5..8565606dc2 100644
--- a/packages/react/src/hooks/useHover.ts
+++ b/packages/react/src/hooks/useHover.ts
@@ -396,7 +396,7 @@ export function useHover<RT extends ReferenceType = ReferenceType>(
       clearTimeout(restTimeoutRef.current);
       clearPointerEvents();
     };
-  }, [enabled, cleanupMouseMoveHandler, clearPointerEvents]);
+  }, [enabled, domReference, cleanupMouseMoveHandler, clearPointerEvents]);
 
   return React.useMemo(() => {
     if (!enabled) {


Test patch:
diff --git a/packages/react/test/unit/useHover.test.tsx b/packages/react/test/unit/useHover.test.tsx
index 6f8bc5e1e3..8e554fd7b9 100644
--- a/packages/react/test/unit/useHover.test.tsx
+++ b/packages/react/test/unit/useHover.test.tsx
@@ -177,3 +177,23 @@ test('mouseleave on the floating element closes it (mouse)', async () => {
 
   expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
 });
+
+test('does not show after delay if domReference changes', async () => {
+  const {rerender} = render(<App delay={1000} />);
+
+  fireEvent.mouseEnter(screen.getByRole('button'));
+
+  await act(async () => {
+    vi.advanceTimersByTime(1);
+  });
+
+  rerender(<App showReference={false} />);
+
+  await act(async () => {
+    vi.advanceTimersByTime(999);
+  });
+
+  expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
+
+  cleanup();
+});
Repository: faker-js/faker (TypeScript)

Issue:
email address local part shouldnt start or end with .
Inspired by https://github.com/faker-js/faker/discussions/1881

`faker.internet.email("John*","Doe.") //John_Doe.@yahoo.com`

The code is correctly stripping special chars like * but allowing .

BUT email address local parts are not allowed to start or end with a dot or contain multiple consecutive dots





Discussion:

Patch:
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 2623f8b3f3f..c0355209b86 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -109,6 +109,13 @@ export class InternetModule {
       );
     }
 
+    // local parts may not contain two or more consecutive . characters
+    localPart = localPart.replace(/\.{2,}/g, '.');
+
+    // local parts may not start with or end with a . character
+    localPart = localPart.replace(/^\./, '');
+    localPart = localPart.replace(/\.$/, '');
+
     return `${localPart}@${provider}`;
   }
 


Test patch:
diff --git a/test/internet.spec.ts b/test/internet.spec.ts
index c2d8fcb22d8..0730f384b62 100644
--- a/test/internet.spec.ts
+++ b/test/internet.spec.ts
@@ -133,6 +133,30 @@ describe('internet', () => {
           expect(faker.definitions.internet.free_email).toContain(suffix);
         });
 
+        it('should not allow an email that starts or ends with a .', () => {
+          const email = faker.internet.email('...Aiden...', '...Doe...');
+
+          expect(email).toBeTruthy();
+          expect(email).toBeTypeOf('string');
+          expect(email).toSatisfy(validator.isEmail);
+
+          const [prefix] = email.split('@');
+          expect(prefix).not.toMatch(/^\./);
+          expect(prefix).not.toMatch(/\.$/);
+        });
+
+        it('should not allow an email with multiple dots', () => {
+          const email = faker.internet.email('Ai....den');
+
+          expect(email).toBeTruthy();
+          expect(email).toBeTypeOf('string');
+          expect(email).toSatisfy(validator.isEmail);
+
+          const [prefix] = email.split('@');
+          //expect it not to contain multiple .s
+          expect(prefix).not.toMatch(/\.{2,}/);
+        });
+
         it('should return an email with given firstName and lastName', () => {
           const email = faker.internet.email('Aiden', 'Harann');
Repository: honojs/hono (TypeScript)

Issue:
Inaccurate RPC client requests due to regex patterns in paths
There is a current issue where using regex patterns in paths leads to wrong request path processing by the RPC client. To resolve this, we need to ensure the client ignores regex patterns in paths for proper request handling.

### Steps to Reproduce
Assume we have a router path like `/post/:id{[0-9]+}`. Under normal circumstances, we should be able to make a request with the RPC client using something like `await client.post[':id{[0-9]}'].$get(...)`.

However, the RPC client currently doesn't ignore the regex pattern, leading it to send a request to `/post/123%7B[0-9]+%7D` when the provided path parameter (in this case, id) is 123. This is not the intended behavior and needs to be addressed.


Discussion:

Patch:
diff --git a/deno_dist/client/utils.ts b/deno_dist/client/utils.ts
index 8c71be20b..017c7c10c 100644
--- a/deno_dist/client/utils.ts
+++ b/deno_dist/client/utils.ts
@@ -9,7 +9,7 @@ export const mergePath = (base: string, path: string) => {
 
 export const replaceUrlParam = (urlString: string, params: Record<string, string>) => {
   for (const [k, v] of Object.entries(params)) {
-    const reg = new RegExp('/:' + k)
+    const reg = new RegExp('/:' + k + '({[^}]*})?')
     urlString = urlString.replace(reg, `/${v}`)
   }
   return urlString
diff --git a/src/client/utils.ts b/src/client/utils.ts
index e7a7fdc26..4cdc0702c 100644
--- a/src/client/utils.ts
+++ b/src/client/utils.ts
@@ -9,7 +9,7 @@ export const mergePath = (base: string, path: string) => {
 
 export const replaceUrlParam = (urlString: string, params: Record<string, string>) => {
   for (const [k, v] of Object.entries(params)) {
-    const reg = new RegExp('/:' + k)
+    const reg = new RegExp('/:' + k + '({[^}]*})?')
     urlString = urlString.replace(reg, `/${v}`)
   }
   return urlString


Test patch:
diff --git a/src/client/utils.test.ts b/src/client/utils.test.ts
index 46d1b62f4..f348d7341 100644
--- a/src/client/utils.test.ts
+++ b/src/client/utils.test.ts
@@ -20,6 +20,16 @@ describe('replaceUrlParams', () => {
     const replacedUrl = replaceUrlParam(url, params)
     expect(replacedUrl).toBe('http://localhost/posts/123/comments/456')
   })
+
+  it('Should replace correctly when there is regex pattern', () => {
+    const url = 'http://localhost/posts/:postId{[abc]+}/comments/:commentId{[0-9]+}'
+    const params = {
+      postId: 'abc',
+      commentId: '456',
+    }
+    const replacedUrl = replaceUrlParam(url, params)
+    expect(replacedUrl).toBe('http://localhost/posts/abc/comments/456')
+  })
 })
 
 describe('removeIndexString', () => {
Repository: sindresorhus/type-fest (TypeScript)

Issue:
`SetRequired` incorrectly combines union types
`SetRequired` appears to incorrectly combine the individual types of union types:

```
type Test =
  | {
      type: "foo";
      a: 1;
      b?: 2;
    }
  | {
      type: "bar";
      a: 2;
      b?: 3;
    };

type TestRequired = SetRequired<Partial<Test>, "type">;
```

The resulting type is:

```
type TestRequired = {
    a?: 1 | undefined;
    b?: 2 | undefined;
    type: "foo" | "bar";
} | {
    a?: 2 | undefined;
    b?: 3 | undefined;
    type: "foo" | "bar";
}
```

Instead of what I intuitively expect:

```
type TestRequired = {
    type: "foo";
    a?: 1;
    b?: 2;
} | {
    type: "bar";
    a?: 2;
    b?: 3;
}
```

Is this desired behavior?


Discussion:
It's a bug.



Patch:
diff --git a/source/set-required.d.ts b/source/set-required.d.ts
index d25e6e0d8..7acdc50f1 100644
--- a/source/set-required.d.ts
+++ b/source/set-required.d.ts
@@ -28,8 +28,7 @@ type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
 */
 export type SetRequired<BaseType, Keys extends keyof BaseType> =
 	Simplify<
-	// Pick just the keys that are optional from the base type.
-	Except<BaseType, Keys> &
+	BaseType &
 	// Pick the keys that should be required from the base type and make them required.
 	Required<Pick<BaseType, Keys>>
 	>;


Test patch:
diff --git a/test-d/set-required.ts b/test-d/set-required.ts
index ef8ea690c..4094e9cc9 100644
--- a/test-d/set-required.ts
+++ b/test-d/set-required.ts
@@ -16,3 +16,7 @@ expectType<{a: number; b: string; c: boolean}>(variation3);
 // Fail if type changes even if optional is right.
 declare const variation4: SetRequired<{a?: number; b: string; c?: boolean}, 'b' | 'c'>;
 expectNotAssignable<{a?: boolean; b: string; c: boolean}>(variation4);
+
+// Update one required and one optional to required in a union.
+declare const variation5: SetRequired<{a?: '1'; b: string; c?: boolean} | {a?: '2'; b: string; c?: boolean}, 'a' | 'b'>;
+expectType<{a: '1'; b: string; c?: boolean} | {a: '2'; b: string; c?: boolean}>(variation5);
Repository: denoland/std (TypeScript)

Issue:
@std/assert/{`assertEquals` ,`assertNotEquals`} not handle `ArrayBuffer` correctly
**Describe the bug**

Getting wrong results against `ArrayBuffer`.

**Steps to Reproduce**

```ts
import { assertEquals, assertNotEquals } from 'jsr:@std/assert@1.0.14';

const a = Uint8Array.of(1);
const b = Uint8Array.of(2);

Deno.test('assertEquals', function () {
    assertEquals(a.buffer, b.buffer);
});

Deno.test('assertNotEquals', function () {
    assertNotEquals(a.buffer, b.buffer);
});
```

**Expected behavior**

```
assertEquals ... FAILED
assertNotEquals ... ok
```


**Getting instead**

```
assertEquals ... ok
assertNotEquals ... FAILED
```

**Environment**

- **OS**: MacOS 15.5
- **deno version**: `2.4.5`
- **std version**: `1.0.14`



Discussion:

Patch:
diff --git a/assert/equal.ts b/assert/equal.ts
index b1bac455ffea..bd004495b019 100644
--- a/assert/equal.ts
+++ b/assert/equal.ts
@@ -42,8 +42,7 @@ function getKeysDeep(obj: object) {
 }
 
 // deno-lint-ignore no-explicit-any
-const Temporal: any = (globalThis as any).Temporal ??
-  new Proxy({}, { get: () => {} });
+const Temporal = (globalThis as any).Temporal ?? Object.create(null);
 
 /** A non-exhaustive list of prototypes that can be accurately fast-path compared with `String(instance)` */
 const stringComparablePrototypes = new Set<unknown>(
@@ -118,6 +117,12 @@ export function equal(a: unknown, b: unknown): boolean {
       if (a instanceof TypedArray) {
         return compareTypedArrays(a as TypedArray, b as TypedArray);
       }
+      if (a instanceof ArrayBuffer || a instanceof SharedArrayBuffer) {
+        return compareTypedArrays(
+          new Uint8Array(a),
+          new Uint8Array(b as ArrayBuffer | SharedArrayBuffer),
+        );
+      }
       if (a instanceof WeakMap) {
         throw new TypeError("Cannot compare WeakMap instances");
       }


Test patch:
diff --git a/assert/equal_test.ts b/assert/equal_test.ts
index c068e04aefda..cecb09fb92ac 100644
--- a/assert/equal_test.ts
+++ b/assert/equal_test.ts
@@ -490,3 +490,22 @@ Deno.test("equal() with typed arrays", async (t) => {
     });
   });
 });
+
+Deno.test("equal() with ArrayBuffer", async (t) => {
+  await t.step("ArrayBuffer", async (t) => {
+    await t.step("equal", () => {
+      assert(equal(
+        new Uint8Array([1, 2, 3]).buffer,
+        new Uint8Array([1, 2, 3]).buffer,
+      ));
+    });
+  });
+  await t.step("ArrayBuffer", async (t) => {
+    await t.step("not equal", () => {
+      assertFalse(equal(
+        new Uint8Array([1, 2, 3]).buffer,
+        new Uint8Array([1, 2, 4]).buffer,
+      ));
+    });
+  });
+});
Repository: denoland/std (TypeScript)

Issue:
assertNotEquals assertion error message discrepancy
There is an issue with the `assertNotEquals` output int the current version of the library. The assertion error message does not reflect the expected string values accurately. Specifically, the following test case:

`assertNotEquals('1','1');`

is expected to throw an error with the message:

`AssertionError: Expected actual: '1' not to be: '1'.`

However, the current output is:
`AssertionError: Expected actual: 1 not to be: 1.`

**Environment**

- OS: MacOS 12
- deno version: 1.44.0
- std version: 0.226.0



Discussion:
I'm happy to add quotes to strings for this function. WDYT, @kt3k?
The suggestion makes sense to me. Maybe we should use `format` of `std/internal` to make the expression?



Patch:
diff --git a/assert/not_equals.ts b/assert/not_equals.ts
index 10da792b814d..b87fd7dd0beb 100644
--- a/assert/not_equals.ts
+++ b/assert/not_equals.ts
@@ -3,6 +3,7 @@
 
 import { equal } from "./equal.ts";
 import { AssertionError } from "./assertion_error.ts";
+import { format } from "@std/internal/format";
 
 /**
  * Make an assertion that `actual` and `expected` are not equal, deeply.
@@ -27,8 +28,8 @@ export function assertNotEquals<T>(actual: T, expected: T, msg?: string) {
   if (!equal(actual, expected)) {
     return;
   }
-  const actualString = String(actual);
-  const expectedString = String(expected);
+  const actualString = format(actual);
+  const expectedString = format(expected);
   const msgSuffix = msg ? `: ${msg}` : ".";
   throw new AssertionError(
     `Expected actual: ${actualString} not to be: ${expectedString}${msgSuffix}`,


Test patch:
diff --git a/assert/not_equals_test.ts b/assert/not_equals_test.ts
index c9e86bb1de1f..273748cf7791 100644
--- a/assert/not_equals_test.ts
+++ b/assert/not_equals_test.ts
@@ -17,7 +17,18 @@ Deno.test("assertNotEquals() throws", () => {
       assertNotEquals("foo", "foo");
     },
     AssertionError,
-    "Expected actual: foo not to be: foo.",
+    'Expected actual: "foo" not to be: "foo".',
+  );
+  assertThrows(
+    () => {
+      assertNotEquals({ foo: 1 }, { foo: 1 });
+    },
+    AssertionError,
+    `Expected actual: {
+  foo: 1,
+} not to be: {
+  foo: 1,
+}.`,
   );
 });
 
@@ -27,6 +38,6 @@ Deno.test("assertNotEquals() throws with custom message", () => {
       assertNotEquals("foo", "foo", "CUSTOM MESSAGE");
     },
     AssertionError,
-    "Expected actual: foo not to be: foo: CUSTOM MESSAGE",
+    'Expected actual: "foo" not to be: "foo": CUSTOM MESSAGE',
   );
 });
Repository: denoland/std (TypeScript)

Issue:
expect toMatchObject shows "expected... to NOT match"
**Describe the bug**
If the assertion fails, `expect(actual).toMatchObject(expected)` shows that it expected `actual`  "to NOT match" [sic]:

**Steps to Reproduce**

```ts
import { it } from '@std/testing/bdd';
import { expect } from '@std/expect';

const expected = {
  field1: 'abc',
  field2: 'def',
  foo: 'bar',
}

it('toMatchObject', () => {
  expect({ 
    field1: 'abc',
    field2: 'def',
    foo: 'baz',
  }).toMatchObject(expected);
});
```

```
$ deno test denobug.test.ts 
running 1 test from ./denobug.test.ts
toMatchObject ... FAILED (2ms)

 ERRORS 

toMatchObject => https://jsr.io/@std/testing/1.0.5/_test_suite.ts:218:10
error: AssertionError: Expected {
  field1: "abc",
  field2: "def",
  foo: "baz",
} to NOT match {
  field1: "abc",
  field2: "def",
  foo: "bar",
}
```

**Expected behavior**

The output should omit `NOT `. 

**Environment**

<!-- please complete the following information -->

- OS: Fedora Linux
- deno version: 2.1.2
- std version: not sure what to put here? @std/testing is at 1.0.5, expect at 1.0.8



Discussion:

Patch:
diff --git a/expect/_matchers.ts b/expect/_matchers.ts
index 7a9abd5434ea..d73c8d34616d 100644
--- a/expect/_matchers.ts
+++ b/expect/_matchers.ts
@@ -487,9 +487,15 @@ export function toMatchObject(
   const triggerError = () => {
     const actualString = format(context.value);
     const expectedString = format(expected);
-    throw new AssertionError(
-      `Expected ${actualString} to NOT match ${expectedString}`,
-    );
+    if (context.isNot) {
+      throw new AssertionError(
+        `Expected ${actualString} to NOT match ${expectedString}`,
+      );
+    } else {
+      throw new AssertionError(
+        `Expected ${actualString} to match ${expectedString}`,
+      );
+    }
   };
 
   if (context.isNot && pass || !context.isNot && !pass) {


Test patch:
diff --git a/expect/_to_match_object_test.ts b/expect/_to_match_object_test.ts
index 144e51b929bc..e42695d30df6 100644
--- a/expect/_to_match_object_test.ts
+++ b/expect/_to_match_object_test.ts
@@ -1,7 +1,12 @@
 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
 
 import { expect } from "./expect.ts";
-import { AssertionError, assertThrows } from "@std/assert";
+import {
+  AssertionError,
+  assertMatch,
+  assertNotMatch,
+  assertThrows,
+} from "@std/assert";
 
 Deno.test("expect().toMatchObject()", () => {
   const house0 = {
@@ -68,3 +73,20 @@ Deno.test("expect(),toMatchObject() with asyAsymmetric matcher", () => {
     },
   });
 });
+
+Deno.test("expect().toMatchObject() throws the correct error messages", () => {
+  {
+    const e = assertThrows(
+      () => expect({ a: 1 }).toMatchObject({ a: 2 }),
+      Error,
+    );
+    assertNotMatch(e.message, /NOT/);
+  }
+  {
+    const e = assertThrows(
+      () => expect({ a: 1 }).not.toMatchObject({ a: 1 }),
+      Error,
+    );
+    assertMatch(e.message, /NOT/);
+  }
+});
Repository: ArthurSonzogni/FTXUI (C++)

Issue:
Segfault when rendering Gridboxes
Hello! I was looking for a TUI library for my project and I've found FTXUI. I've tried it & I love it so far, great job! 
After trying to use a gridbox I've gotten a segfault. This code should reproduce it:

```
gridbox({
         {
             text("1"),
             text("2"),
             text("3"),
             text("4"),
         },
         {},
         {},
```

Upon minor inspection, the root of the issue is in the consturctor of Gridbox, mainly the `filler()` is not inserted to lines due to while loop checking for y_size instead of x_size. Since in code above `x_size` is 4 and `y_size` is 3 it's gonna miss some fillers & later segfault 
on gridbox.cpp:55 in `ComputeRequirement()`. 

I'd be very happy to submit a pull request (my very first open source PR) but if you prefer to do this minor thing yourself that is fine also!


Discussion:
Thanks!

`gridbox` is very new. You are probably one of the first trying it. Thanks for finding yourself the cause of the bug!

I would be very happy getting PR for this! Don't hesitate.

Along the way, would you mind adding your regression test case into:
https://github.com/ArthurSonzogni/FTXUI/blob/master/src/ftxui/dom/gridbox_test.cpp
```cpp
// Regression test for https://github.com/ArthurSonzogni/FTXUI/issues/259
TEST(GridboxTest, UnfilledRectangular) {
  auto root = gridbox({
      {text("1"), text("2"), text("3"), text("4")},
      {},
      {},
  });

  [...]
}
```

You can run them using:
```sh
cmake .. -DFTXUI_BUILD_TESTS=ON;
make -j tests;
./tests;
```



Patch:
diff --git a/src/ftxui/dom/gridbox.cpp b/src/ftxui/dom/gridbox.cpp
index 0cd619c06..fd715121f 100644
--- a/src/ftxui/dom/gridbox.cpp
+++ b/src/ftxui/dom/gridbox.cpp
@@ -20,7 +20,7 @@ class GridBox : public Node {
     for (const auto& line : lines_)
       x_size = std::max(x_size, (int)line.size());
     for (auto& line : lines_) {
-      while (line.size() < (size_t)y_size) {
+      while (line.size() < (size_t)x_size) {
         line.push_back(filler());
       }
     }


Test patch:
diff --git a/src/ftxui/dom/gridbox_test.cpp b/src/ftxui/dom/gridbox_test.cpp
index c8dae798b..da9bc399f 100644
--- a/src/ftxui/dom/gridbox_test.cpp
+++ b/src/ftxui/dom/gridbox_test.cpp
@@ -569,6 +569,25 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_FlewShrink) {
   }
 }
 
+// Regression test for https://github.com/ArthurSonzogni/FTXUI/issues/259
+TEST(GridboxTest, MissingCells) {
+  auto root = gridbox({
+      {cell("1"), cell("2"), cell("3")},
+      {cell("4"), cell("5")},
+  });
+
+  Screen screen(20, 7);
+  Render(screen, root);
+  EXPECT_EQ(screen.ToString(),
+            "╭─╮╭─╮╭─╮           \r\n"
+            "│1││2││3│           \r\n"
+            "╰─╯╰─╯╰─╯           \r\n"
+            "╭─╮╭─╮              \r\n"
+            "│4││5│              \r\n"
+            "╰─╯╰─╯              \r\n"
+            "                    ");
+}
+
 // Copyright 2020 Arthur Sonzogni. All rights reserved.
 // Use of this source code is governed by the MIT license that can be found in
 // the LICENSE file.
Repository: NVIDIA/stdexec (C++)

Issue:
Repeated `ensure_started` calls don't compile after #673
The following no longer compiles after #673:
```
ex::sync_wait(ex::ensure_started(ex::ensure_started(ex::just())));
```
I think it's meant to pick this overload: https://github.com/NVIDIA/stdexec/blob/2a7b8c0ee8950101b95be2fc0931c79b42effb26/include/stdexec/execution.hpp#L3553-L3556, but no longer does because it can't deduce the template arguments (GCC says `note:   couldn’t deduce template parameter ‘_SenderId’`). I guess this is because of the ADL isolation wrapper which makes that a context in which it simply can't be deduced. I'm not quite sure if there's a simple fix to the ADL isolation wrapper or to the call site... The only thing I can think of is introducing e.g. some tag type into the `ensure_started` sender which can be used to identify it. Do you have a preferred way of fixing this?


Discussion:

Patch:
diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp
index c2c9def12..aedf33bbf 100644
--- a/include/stdexec/execution.hpp
+++ b/include/stdexec/execution.hpp
@@ -3601,6 +3601,14 @@ namespace stdexec {
       using __dispatcher_for =
         __make_dispatcher<__cust_sigs, __mconstructor_for<__sender_t>, _Sender, _Env>;
 
+    template <class _SenderId, class _EnvId>
+    void __test_ensure_started_sender(__sender<_SenderId, _EnvId> const& __sndr2){};
+
+    template <class _Sender>
+    concept __ensure_started_sender = requires(typename _Sender::__id __sndr1) {
+      __test_ensure_started_sender(__sndr1);
+    };
+
     struct ensure_started_t {
       template <sender _Sender, class _Env = __empty_env>
           requires
@@ -3613,9 +3621,8 @@ namespace stdexec {
           return __dispatcher_for<_Sender, _Env>{}((_Sender&&) __sndr, (_Env&&) __env);
         }
 
-      // BUGBUG this will never match
-      template <class _SenderId, class _EnvId>
-        __t<__sender<_SenderId, _EnvId>> operator()(__t<__sender<_SenderId, _EnvId>> __sndr) const {
+      template <__ensure_started_sender _Sender>
+        _Sender operator()(_Sender __sndr) const {
           return std::move(__sndr);
         }
 


Test patch:
diff --git a/test/stdexec/algos/adaptors/test_ensure_started.cpp b/test/stdexec/algos/adaptors/test_ensure_started.cpp
index dbf1b50a0..8b6448551 100644
--- a/test/stdexec/algos/adaptors/test_ensure_started.cpp
+++ b/test/stdexec/algos/adaptors/test_ensure_started.cpp
@@ -276,3 +276,14 @@ TEST_CASE("Dropping the opstate without starting it calls set_stopped", "[adapto
   // make sure the logging_receiver was never called
   CHECK(state == -1);
 }
+
+TEST_CASE("Repeated ensure_started compiles", "[adaptors][ensure_started]") {
+  bool called{false};
+  auto snd1 = ex::just() | ex::then([&] { called = true; });
+  CHECK_FALSE(called);
+  auto snd2 = ex::ensure_started(std::move(snd1));
+  auto snd = ex::ensure_started(std::move(snd2));
+  CHECK(called);
+  auto op = ex::connect(std::move(snd), expect_void_receiver{});
+  ex::start(op);
+}