test(benchmarks): add C#/ASP.NET and TypeScript tasks

Six tasks with hidden checks: ASP.NET validation and 404 handling, C#
cancellation, and TypeScript overlap, deep merge, and debounce fixes, checked
with dotnet run and node --test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-01 13:59:12 +02:00
1 parent 97879fd6a5
commit f43a2df14b
30 files changed
+349 -2

No files matched your search

@@ -0,0 +1,18 @@
import { test, mock } from 'node:test';
import assert from 'node:assert/strict';
import { debounce } from '../src/debounce.ts';
test('trailing call uses the latest arguments', () => {
mock.timers.enable({ apis: ['setTimeout'] });
const calls: number[][] = [];
const run = debounce((value: number) => calls.push([value]), 50);
run(1); run(2); run(3);
mock.timers.tick(49);
assert.deepEqual(calls, []);
mock.timers.tick(1);
assert.deepEqual(calls, [[3]]);
run(4);
mock.timers.tick(50);
assert.deepEqual(calls, [[3], [4]]);
mock.timers.reset();
});
@@ -0,0 +1,5 @@
{
"name": "timing",
"type": "module",
"private": true
}
@@ -0,0 +1,15 @@
export function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number): (...args: T) => void {
let timer: ReturnType<typeof setTimeout> | undefined;
let pending: T | undefined;
return (...args: T) => {
if (pending === undefined) {
pending = args;
}
clearTimeout(timer);
timer = setTimeout(() => {
const call = pending as T;
pending = undefined;
fn(...call);
}, wait);
};
}
@@ -0,0 +1,13 @@
{
"prompt": "debounce() calls the wrapped function with the arguments of the first call in a burst instead of the last one. Fix it so the trailing call uses the latest arguments.",
"check": [
"node",
"--experimental-strip-types",
"--no-warnings",
"--test",
"bench_hidden/check.test.ts"
],
"workflow": {
"kind": "TypeScript change"
}
}