JoshuaKGoldberg / JoshuaKGoldberg/TypeStat

🧪 Testing: Establish a preference for small, self-contained mutation tests

Open
#1,504 3 comments 0 reactions 0 assignees View on GitHub
area: documentation area: testing status: accepting prs
Dominant language
TypeScript
Stars
2.3k
Forks
47
Avg merge
15h 55m
Merged PRs (30d)
21

Description

## Overview

This is something I'd wanted to start on ages ago, but never had the time and never got around to writing down...

Today, there are quite a few mutation tests that have a _lot_ of stuff in them. Example: https://github.com/JoshuaKGoldberg/TypeStat/blob/16f76cf106033d5ca45da3eed82de3120aae4c08/test/cases/fixes/noImplicitAny/variableDeclarations/original.ts is just over 200 lines. Large mutation tests were handy when I was getting started on TypeStat many years ago and wanted to quickly iterate on many things at once.

But, the library is a bit more settled now, and these huge tests are unwieldy. It's hard to precisely check one thing at a time with them or search for where one thing is tested for. Example: to test `noImplicitAny` with variable declarations and Promise resolves, I'd probably temporarily comment out all but the last ~10 lines of the aforementioned `variableDeclarations/original.ts` file.

Proposal: let's...
1. Quick change: mention in `.github/DEVELOPMENT.md` a preference for small, self-contained mutation tests
2. Larger change: split up each of these larger `original.ts` files into families of more granular ones

WDYT @rubiesonthesky?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.