Updated sonarcloud #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: .github/workflows/login-test.yml | |
name: Login Component Tests | |
on: | |
push: | |
branches: | |
- '**' # Runs on any branch push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
working-directory: ./Frontend # Navigate to Frontend directory to install dependencies | |
run: npm install | |
- name: Run tests and save results to JSON | |
working-directory: ./Frontend # Ensure tests run in the Frontend directory | |
run: | | |
mkdir -p ./test-results # Create directory for test results if it doesn't exist | |
npm test -- --testPathPattern=src/Login.test.js --outputFile=./test-results/jest-results.json --json # Run tests and save results as JSON | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: ./Frontend/test-results/jest-results.json # Path to the JSON test results file |