Deleting 500 tests made the suite stronger
Описание и применение
Удаление 500 тестов улучшило набор тестов, сделав его более точным и быстрым, с параллельным запуском и механизмом обнаружения незначимых тестов.
Задача
A large number of tests in the workkit project were failing for reasons that did not reflect real behaviour, creating noise and slowing down the test suite.
Результат
The test suite was trimmed from ~500 tests to a smaller, more focused set, improving reliability and reducing execution time. Parallel execution and safety hooks further enhanced test quality.
Рабочий процесс
- 1. Run npm test to execute all suites sequentially.
- 2. Introduce parallel runner in version 0.81 to run each suite in its own worker process.
- 3. Audit each test to determine if a failure indicates real behaviour change.
- 4. Remove or rewrite tests that fail for mock or implementation details.
- 5. Add safety:test-bar hook to flag padding tests at write time.
- 6. Update commit gate to run npm test on staged files only.
- 7. Verify suite runs with reduced test count and parallel execution.
Доказательства
About 450 cases said no. They asserted that a mock was called, that a file existed after a write, that a framework did what its docs promise.
The kit's npm test used to run every suite in one process, one after another. Version 0.81 gave it a parallel runner: each suite runs in its own worker process, with cores minus one running at once.
The safety:test-bar hook fires when a test file is written. It names each line that misses the bar: an assertion on an implementation detail, a mock of something the test could run for real, a test with no failure condition.
- Дата записи: 2026-11-02T06:58:56.711Z