Commit a946efd
authored
audit-writers.test.ts resolved @objectstack/core and its translation
bundle with `await import(...)` inside the first localized test's helper,
so that single test paid the whole cold-start cost — resolution plus vite
transform of a large barrel — while every later case ran warmed in ~1ms.
That is real work billed to a per-test timeout budget. The file already
carried a { timeout: 20_000 } override for exactly this reason (its
comment measured the cold start at ~5s on a 4-vCPU runner). Under a
full-repo `pnpm test`, where a dozen packages' vitest workers compete,
the cold start grew past that bound too and the case failed at 20s —
reproducibly under load, never in isolation, which is the worst shape a
red test can have: it tracks machine load rather than code.
Both imports are now static, so the same work happens during collection,
which no single test's timeout is charged for. The previously failing
case runs in 1ms and the timeout override is gone — the default timeout
is an honest bound again, and a case that exceeds it is a real hang.
No cycle motivated the lazy form: plugin-audit depends on
@objectstack/core normally, and this package's own audit-plugin.ts
already imports it statically.
Verified under the condition that reproduced the failure: a full-repo
`pnpm test` now passes 132/132, with audit-writers.test.ts at 172ms for
all 30 cases (previously the one zh-CN case alone took 20347ms and
timed out).
Closes #4186
1 parent 74aa3f0 commit a946efd
2 files changed
Lines changed: 43 additions & 15 deletions
File tree
- .changeset
- packages/plugins/plugin-audit/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
5 | 15 | | |
6 | 16 | | |
7 | 17 | | |
| |||
530 | 540 | | |
531 | 541 | | |
532 | 542 | | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
540 | 547 | | |
541 | 548 | | |
542 | 549 | | |
543 | 550 | | |
544 | | - | |
545 | | - | |
546 | | - | |
| 551 | + | |
547 | 552 | | |
548 | 553 | | |
549 | 554 | | |
| |||
580 | 585 | | |
581 | 586 | | |
582 | 587 | | |
583 | | - | |
| 588 | + | |
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
| |||
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
593 | | - | |
| 598 | + | |
594 | 599 | | |
595 | 600 | | |
596 | 601 | | |
| |||
605 | 610 | | |
606 | 611 | | |
607 | 612 | | |
608 | | - | |
| 613 | + | |
609 | 614 | | |
610 | 615 | | |
611 | 616 | | |
| |||
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
634 | | - | |
| 639 | + | |
635 | 640 | | |
636 | 641 | | |
637 | 642 | | |
| |||
662 | 667 | | |
663 | 668 | | |
664 | 669 | | |
665 | | - | |
| 670 | + | |
666 | 671 | | |
667 | 672 | | |
668 | 673 | | |
| |||
0 commit comments