Research and Provide a Demo of Unit Testing for GHAs
- Dominant language
- JavaScript
- Stars
- 363
- Forks
- 872
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 18
Description
### Dependency
- [x] #6454
### Overview
We need to develop a sample set of unit tests against the JavaScript code in HfLA GitHub Actions, along with a new workflow that will invoke the tests in response to push and pull request triggers, in order to implement a GitHub PR check that will help ensure the quality of GHA code.
### Action Items
- [ ] Select one of the following JS test frameworks: Jest, Mocha and Jasmine. Consider:
- [ ] widely-used JS test framework suitable for invoking tests against JavaScript code within the HfLA GitHub Actions
- [ ] Provide a comment documenting the selection, installation and configuration of the test framework
- [ ] In a new git branch, create a folder `unit-tests-GHAs`
- [ ] Add unit tests for at least one GitHub Action
- [ ] Create a new workflow `.github/workflows/unit-tests-GHAs` that will invoke all of the unit tests in the new folder and will display the results for each test and will return a result scuh that merge will be blocked if any test fails.
- [ ] Test in your fork of the website repository
- [ ] Create a PR with instructions for other developers to invoke the workflow from their forks.
### Resources/Instructions
https://jasmine.github.io/
https://raygun.com/blog/javascript-unit-testing-frameworks/
https://www.browserstack.com/guide/jest-vs-mocha-vs-jasmine
[How to Test a GitHub Action with GitHub Actions](https://dev.to/cicirello/how-to-test-a-github-action-with-github-actions-2hag)
[Publish and view Mocha test results in Github Actions](https://medium.com/@ma11hewthomas/publish-and-view-mocha-test-results-in-github-actions-5ae74b59f4d6)
[Test workflow from Mocha examples](https://github.com/mochajs/mocha-examples/blob/main/.github/workflows/test.yml)
- This issue is a follow-up to #2249. In particular see https://github.com/hackforla/website/issues/2249#issuecomment-2113750578
Contributor guide
Assessment
This issue has not been assessed yet.