Skip to content

Commit 4667ff8

Browse files
committed
Test coverage
1 parent fce4ee7 commit 4667ff8

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

.github/workflows/main.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,28 @@ on:
88
jobs:
99
test:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
checks: write
13+
pull-requests: write
1114
steps:
1215
- uses: actions/checkout@v4
1316
- uses: denoland/setup-deno@v2
1417
with:
1518
deno-version: v2.x
16-
- run: deno task test-all
19+
- run: deno task test --coverage --junit-path=test-report.xml
20+
env:
21+
RUST_BACKTRACE: ${{ runner.debug }}
22+
- uses: EnricoMi/publish-unit-test-result-action@v2
23+
with:
24+
check_name: "Test Results"
25+
files: test-report.xml
26+
continue-on-error: true
27+
- run: deno coverage --lcov > coverage.lcov
28+
- uses: codecov/codecov-action@v5
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}
31+
files: coverage.lcov
32+
- run: deno task check
1733

1834
publish:
1935
if: github.event_name == 'push'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage/

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
==================
55

66
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]
7+
[![Codecov][Codecov badge]][Codecov]
78

89
> [!NOTE]
910
> BotKit is still in early development. The API may change in the future.
@@ -60,6 +61,8 @@ For more information, see the [BotKit docs][BotKit].
6061
[BotKit]: https://botkit.fedify.dev/
6162
[GitHub Actions]: https://github.com/dahlia/botkit/actions/workflows/main.yaml
6263
[GitHub Actions badge]: https://github.com/dahlia/botkit/actions/workflows/main.yaml/badge.svg
64+
[Codecov]: https://codecov.io/gh/dahlia/botkit
65+
[Codecov badge]: https://codecov.io/gh/dahlia/botkit/graph/badge.svg?token=dMbBbQvk4v
6366
[ActivityPub]: https://activitypub.rocks/
6467
[Fedify]: https://fedify.dev/
6568

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"check": "deno check src/ && deno lint && deno fmt --check && deno publish --dry-run --allow-dirty",
4242
"test": "deno test --allow-net=hollo.social",
4343
"test-all": "deno task check && deno task test",
44+
"coverage": "deno task test --coverage && deno coverage --html",
4445
"hooks:install": "deno run --allow-read=deno.json,.git/hooks/ --allow-write=.git/hooks/ jsr:@hongminhee/deno-task-hooks",
4546
"hooks:pre-commit": "deno task check"
4647
}

src/text.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
markdown,
3939
mention,
4040
mentions,
41+
strong,
4142
type Text,
4243
text,
4344
} from "./text.ts";
@@ -471,10 +472,10 @@ Deno.test("em()", async () => {
471472

472473
Deno.test("strong()", async () => {
473474
const session = bot.getSession("https://example.com");
474-
const t: Text<"inline", void> = em("Hello, World");
475+
const t: Text<"inline", void> = strong("Hello, World");
475476
assertEquals(
476477
(await Array.fromAsync(t.getHtml(session))).join(""),
477-
"<em>Hello, World</em>",
478+
"<strong>Hello, World</strong>",
478479
);
479480
assertEquals(await Array.fromAsync(t.getTags(session)), []);
480481
assertEquals(t.getCachedObjects(), []);

0 commit comments

Comments
 (0)