Skip to content

Commit

Permalink
Add unit test coverage; update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
russelporosky committed Oct 26, 2022
1 parent b96bf9a commit d79d21b
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 55 deletions.
3 changes: 2 additions & 1 deletion .compodocrc.browser.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"includes": "./",
"output": "./documentation/browser",
"theme": "readthedocs",
"tsconfig": "./projects/browser/tsconfig.doc.browser.json"
"tsconfig": "./projects/browser/tsconfig.doc.browser.json",
"unitTestCoverage": "./projects/browser/coverage-summary.json"
}
2 changes: 1 addition & 1 deletion .github/workflows/angularTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: Lint CSS, HTML, and TS
run: npm run lint
- name: Run tests
run: npm run test:ci
run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadless
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,14 @@ The schematics will currently create TypeScript files with spaces for indentatio

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
Run `npn run test` to execute the unit tests via [Karma](https://karma-runner.github.io). Run `npm run test:coverage` to create an updated coverage report that can be display in the generated documentation (you'll need to build the documentation in order to see the changes).

## Continuous integration

An `npm run test:ci` exists that runs tests a single time and uses a headless browser. This is used by the GitHub workflow for linting and testing the project.

Since the environment can't be built without a `.env` file in the environment folder, the workflow simply copies `.env.example` to `projects/browser/src/environments/.env` to allow the build process to succeed. If your tests rely on specific environment values, you'll need to create repository secrets through GitHub that contains those values (which keeps things like API keys out of the repository itself), *or* put default values into the `.env.example` file, with the understanding that those values will become part of the repository once you commit that change.

## Further help
Expand Down
9 changes: 9 additions & 0 deletions documentation/browser/images/coverage-badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions documentation/browser/images/coverage-badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions documentation/browser/images/coverage-badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions documentation/browser/images/coverage-badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions documentation/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ <h2 id="running-unit-tests">Running unit tests</h2>
<p>Run <code>ng test</code> to execute the unit tests via <a href="https://karma-runner.github.io">Karma</a>.</p>
<h2 id="running-end-to-end-tests">Running end-to-end tests</h2>
<p>Run <code>ng e2e</code> to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.</p>
<h2 id="continuous-integration">Continuous integration</h2>
<p>Since the environment can&#39;t be built without a <code>.env</code> file in the environment folder, the workflow simply copies <code>.env.example</code> to <code>projects/browser/src/environments/.env</code> to allow the build process to succeed. If your tests rely on specific environment values, you&#39;ll need to create repository secrets through GitHub that contains those values (which keeps things like API keys out of the repository itself), <em>or</em> put default values into the <code>.env.example</code> file, with the understanding that those values will become part of the repository once you commit that change.</p>
<h2 id="further-help">Further help</h2>
<p>To get more help on the Angular CLI use <code>ng help</code> or go check out the <a href="https://angular.io/cli">Angular CLI Overview and Command Reference</a> page.</p>

Expand Down
3 changes: 3 additions & 0 deletions documentation/browser/js/menu-wc.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
<li class="chapter">
<a data-type="chapter-link" href="coverage.html"><span class="icon ion-ios-stats"></span>Documentation coverage</a>
</li>
<li class="chapter">
<a data-type="chapter-link" href="unit-test.html"><span class="icon ion-ios-podium"></span>Unit test coverage</a>
</li>
<li class="divider"></li>
<li class="copyright">
Documentation generated using <a href="https://compodoc.app/" target="_blank">
Expand Down
Loading

0 comments on commit d79d21b

Please sign in to comment.