fix(e2e): non-mutating reverse in CleanupRegistry
Array.reverse mutates in place — a defensive double-run() would have re-reversed the items. Iterate over a copy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,10 @@ export class CleanupRegistry {
|
|||||||
if (this.items.length === 0) return;
|
if (this.items.length === 0) return;
|
||||||
const api = await adminApi();
|
const api = await adminApi();
|
||||||
try {
|
try {
|
||||||
for (const item of this.items.reverse()) {
|
// Copy-then-reverse so a defensive double-`run()` (or a
|
||||||
|
// caller that inspects the registry after a partial
|
||||||
|
// teardown) doesn't see the items in a re-reversed order.
|
||||||
|
for (const item of [...this.items].reverse()) {
|
||||||
try {
|
try {
|
||||||
await item(api);
|
await item(api);
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user