Skip to content

Commit 651d7ff

Browse files
author
Anatoly Ostrovsky
committed
Add test coverage
1 parent 4a07179 commit 651d7ff

9 files changed

Lines changed: 1990 additions & 51 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ tsconfig.tsbuildinfo
66
/test-results/
77
/playwright-report/
88
/blob-report/
9+
/.coverage/
10+
/coverage/
911
/playwright/.cache/
1012
.idea
1113
.vscode

Makefile

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build build-ts test types
1+
.PHONY: build build-ts test types coverage coverage-check coverage-open
22

33
BUILD_DIR = ./dist
44
TS_BUILD_DIR = ./.build
@@ -21,7 +21,9 @@ build:
2121
rm -r "$(TS_BUILD_DIR)"; \
2222
fi
2323
@npm i
24-
@npm run build
24+
@./node_modules/.bin/tsc --project tsconfig.build.json
25+
@./node_modules/.bin/rollup -c
26+
@rm -rf .build
2527

2628
build-ts:
2729
@if [ -d "$(TS_BUILD_DIR)" ]; then \
@@ -31,7 +33,7 @@ build-ts:
3133
@./node_modules/.bin/tsc --project tsconfig.build.json
3234

3335
size:
34-
@npm run build >/dev/null
36+
@$(MAKE) build >/dev/null
3537
@echo "Minified build output: $$(stat -c %s dist/angular-ts.umd.min.js) ~ $$(stat -c %s dist/angular-ts.umd.min.js | numfmt --to=iec)"
3638
@echo "Expected gzip: $$(gzip -c dist/angular-ts.umd.min.js | wc -c) ~ $$(gzip -c dist/angular-ts.umd.min.js | wc -c | numfmt --to=iec)"
3739
@git checkout -q $(BUILD_DIR)
@@ -66,7 +68,9 @@ check:
6668

6769
types:
6870
@echo "Generating *.d.ts"
69-
@npm run types
71+
@rm -rf @types
72+
@./node_modules/.bin/tsc --project tsconfig.types.json
73+
@npx prettier ./@types --write --cache --log-level=silent
7074

7175
TYPEDOC_DIR = docs/static/typedoc
7276
doc:
@@ -92,5 +96,18 @@ test-ui:
9296
@echo $(INFO) "Playwright test JS with ui"
9397
@$(PLAYWRIGHT_TEST) --ui
9498

99+
coverage:
100+
@echo $(INFO) "Playwright coverage"
101+
@node ./utils/run-coverage.mjs
102+
103+
coverage-check:
104+
@echo $(INFO) "Playwright coverage threshold check"
105+
@node ./utils/run-coverage.mjs --check
106+
107+
coverage-open:
108+
@echo $(INFO) "Open coverage report"
109+
@node ./utils/open-coverage.mjs
110+
95111
hugo:
96112
hugo server --source=docs --disableFastRender
113+

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,13 @@ or a source of inspiration for new ideas.
6060
## Documentation
6161

6262
Go to https://angular-wave.github.io/angular.ts/
63+
64+
## Development
65+
66+
- Run the Playwright suite: `make test`
67+
- Generate browser coverage for `src/` tests only: `make coverage`
68+
- Generate browser coverage with threshold enforcement for `src/` tests only: `make coverage-check`
69+
- Open the HTML report at `coverage/index.html`
70+
- Open the HTML report automatically: `make coverage-open`
71+
- Docs example tests under `docs/` are excluded from coverage runs
72+
- `coverage-check` currently enforces minimums of 80% statements, 80% lines, 80% functions, and 70% branches

0 commit comments

Comments
 (0)