You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide focuses on the most common and idiomatic patterns for writing TypeScript tests. For complex scenarios, refer to existing tests in the codebase for additional patterns and techniques.
260
+
## Important Guidelines
261
+
262
+
### Test Locations
263
+
- Only add testcases in `tests/cases/compiler` or `tests/cases/fourslash`
264
+
- Do not write direct unit tests as they are almost never the correct test format for our repo
265
+
266
+
### Performance Expectations
267
+
- Running a set of tests may take up to 4 minutes
268
+
- A full test run may take up to 15 minutes
269
+
- Always run `hereby lint` and `hereby format` before you're done
270
+
271
+
### Working with Issues
272
+
- Maintainer comments in the issue should generally take priority over OP's comments
273
+
- Maintainers might give you hints on where to start. They are not always right, but a good place to start
274
+
275
+
## Recommended Workflow
276
+
277
+
When fixing bugs or implementing features, follow this workflow:
278
+
279
+
1.**Make a testcase that demonstrates the behavior**
280
+
- Run it (by itself) and review the baselines it generates to ensure it demonstrates the bug
281
+
- Add the test and its baselines in one commit
282
+
283
+
2.**Fix the bug by changing code as appropriate**
284
+
- Put this fix in another commit
285
+
286
+
3.**Run the test you wrote again**
287
+
- Ensure the baselines change in a way that demonstrates that the bug is fixed
288
+
- Put this baseline diff in its own commit
289
+
290
+
4.**Run all other tests to ensure you didn't break anything**
291
+
- Some collateral baseline changes are normal
292
+
- Put these diffs in another commit
293
+
294
+
All fixes should use one of these two test formats. Do not use unit tests as they are almost never the correct test format for our repo.
0 commit comments