Skip to content

Commit

Permalink
GitHub action for Unit test (#555)
Browse files Browse the repository at this point in the history
* added github action for unit test

* updated unit-test-reporter.yaml

* updated unit-test-reporter.yaml
  • Loading branch information
niranjan-n1 authored Apr 4, 2023
1 parent 59b0bc1 commit 3e52240
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/unit-test-reporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Unit Test Action

on:
push:
branches: [ main ]
pull_request:
branches: [ main, release-1.7.0 ]
jobs:
build-test:
name: Build & Run Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run Tests
working-directory: ./content/docs/deployment/csminstallationwizard/src/
run: |
npm install
npm test
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
./content/docs/deployment/csminstallationwizard/src/reports/*.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ public/
resources/
.hugo_build.lock
coverage/
reports/
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ module.exports = {
setupFiles: ["./jest.setup.js"],

// The test environment that will be used for testing
testEnvironment: "jsdom"
testEnvironment: "jsdom",

reporters: [
'default',
['jest-junit', {outputDirectory: 'reports', outputName: 'report.xml'}],
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "",
"scripts": {
"test": "jest",
"test": "jest --ci",
"coverage": "jest --coverage"
},
"repository": {
Expand All @@ -19,6 +19,7 @@
"devDependencies": {
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jquery": "^3.6.3"
"jquery": "^3.6.3",
"jest-junit": "^15.0.0"
}
}

0 comments on commit 3e52240

Please sign in to comment.