Skip to content

Commit 3246681

Browse files
committed
docs: add GitHub Copilot instructions for code, commits, and tests
1 parent 23186de commit 3246681

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

.github/copilot/code-instructions.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GitHub Copilot Code Instructions
2+
3+
Arrow functions that return a JSON object should always use a block with a `return` statment.
4+
5+
Examples:
6+
7+
```ts
8+
// Good
9+
() => {
10+
return {
11+
some: 'data',
12+
};
13+
};
14+
15+
// Bad
16+
() => ({ some: 'data' });
17+
```
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# GitHub Copilot Commit Instructions
2+
3+
Use conventional commit messages.
4+
5+
The types we use in this project are:
6+
7+
- feat
8+
- fix
9+
- test
10+
- docs
11+
- chore

.github/copilot/test-instructions.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# GitHub Copilot Test Instructions
2+
3+
We use `vitest`.
4+
5+
Include the following import when creating a new file:
6+
7+
```ts
8+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
9+
```
10+
11+
The outermost `describe` should be named for the file being tested.
12+
For example, if testing "game.parser.ts" then you would use `describe('game-parser')`.
13+
14+
The inner sibling `describe` blocks should be named after the public methods from the class being tested.
15+
For example, if the class has the public method "getData" then you would use `describe('#getData')`.
16+
17+
The outermost `describe` should include the `beforeEach` and `afterEach` functions.
18+
19+
Within the inner `describe` blocks, use the `it` function to define the tests.
20+
Name the tests using either the `it should {action} when {condition}` or `it {imperative}` formats.
21+
For example, `it('should skip when log level is not enabled')` or `it('emits event to all subscribers')`.
22+
23+
The function argument passed to the `describe` blocks should be synchronous, `() => {}`.
24+
25+
The function argument passed to the `it` blocks should be asynchronous, `async () => {}`.

0 commit comments

Comments
 (0)