Skip to content

Commit aafd918

Browse files
committed
build: add test coverage targets to Makefile and npm scripts
- Add test-coverage target to generate text coverage report - Add test-coverage-report target to generate LCOV coverage report - Add test:coverage and test:coverage:report npm scripts for convenience - Coverage reports help identify gaps in test coverage and track code quality Signed-off-by: leocavalcante <leo@cavalcante.dev>
1 parent 5634647 commit aafd918

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PREFIX ?= /usr/local
22
VERSION ?= 1.0.0
33

4-
.PHONY: all dev test lint format clean install build-linux-x64 build-darwin-arm64 build-windows build-all
4+
.PHONY: all dev test test-coverage test-coverage-report lint format clean install build-linux-x64 build-darwin-arm64 build-windows build-all
55

66
all:
77
bun build --compile --minify --sourcemap \
@@ -14,6 +14,12 @@ dev:
1414
test:
1515
bun test
1616

17+
test-coverage:
18+
bun test --coverage
19+
20+
test-coverage-report:
21+
bun test --coverage --coverage-reporter=lcov
22+
1723
lint:
1824
bunx biome check src/ tests/
1925

@@ -24,7 +30,7 @@ format:
2430
bunx biome format --write src/ tests/
2531

2632
clean:
27-
rm -rf opencoder opencoder-* opencoder.exe node_modules bun.lockb
33+
rm -rf opencoder opencoder-* opencoder.exe node_modules bun.lockb coverage/
2834

2935
install: all
3036
install -d $(PREFIX)/bin

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"build:darwin": "bun build --compile --minify --sourcemap --target=bun-darwin-arm64 src/index.ts --outfile opencoder-darwin-arm64",
1616
"build:windows": "bun build --compile --minify --sourcemap --target=bun-windows-x64 src/index.ts --outfile opencoder.exe",
1717
"test": "bun test",
18+
"test:coverage": "bun test --coverage",
19+
"test:coverage:report": "bun test --coverage --coverage-reporter=lcov",
1820
"lint": "bunx biome check src/ tests/",
1921
"lint:fix": "bunx biome check --write src/ tests/",
2022
"format": "bunx biome format --write src/ tests/"

0 commit comments

Comments
 (0)