aboutsummaryrefslogtreecommitdiff
path: root/test/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'test/README.md')
-rw-r--r--test/README.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/README.md b/test/README.md
index 36fe3b005..03f9c97af 100644
--- a/test/README.md
+++ b/test/README.md
@@ -71,3 +71,13 @@ In the future, a bot will automatically close or re-open issues when a regressio
These tests live in various `.zig` files throughout Bun's codebase, leveraging Zig's builtin `test` keyword.
Currently, they're not run automatically nor is there a simple way to run all of them. We will make this better soon.
+
+## TypeScript
+
+Test files should be written in TypeScript. The types in `packages/bun-types` should be updated to support all new APIs. Changes to the `.d.ts` files in `packages/bun-types` will be immediately reflected in test files; no build step is necessary.
+
+Writing a test will often require using invalid syntax, e.g. when checking for errors when an invalid input is passed to a function. TypeScript provides a number of escape hatches here.
+
+- `// @ts-expect-error` - This should be your first choice. It tells TypeScript that the next line *should* fail typechecking.
+- `// @ts-ignore` - Ignore the next line entirely.
+- `// @ts-nocheck` - Put this at the top of the file to disable typechecking on the entire file. Useful for autogenerated test files, or when ignoring/disabling type checks an a per-line basis is too onerous.