- Configured Jenkins FreeStyle job to trigger on push - Added `npm install` and `npm test` steps in Jenkins build configuration - Updated pre-push hook script to trigger Jenkins job and wait for test results - Installed jest, @testing-library/react, and @testing-library/jest-dom as dev dependencies for testing This commit sets up automated testing in Jenkins before code is pushed to the remote repository, ensuring code quality and preventing broken builds.
33 lines
690 B
Groovy
33 lines
690 B
Groovy
pipeline {
|
|
agent any
|
|
|
|
stages {
|
|
stage('Install Dependencies') {
|
|
steps {
|
|
// Installiere npm Abhängigkeiten
|
|
sh 'npm install'
|
|
}
|
|
}
|
|
|
|
stage('Run Tests') {
|
|
steps {
|
|
// Führt Ihre Tests aus
|
|
sh 'npm test'
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
// Archivieren Sie die Testberichte, wenn verfügbar
|
|
junit '**/test-results.xml'
|
|
}
|
|
success {
|
|
echo 'Die Tests wurden erfolgreich abgeschlossen!'
|
|
}
|
|
failure {
|
|
echo 'Einige Tests sind fehlgeschlagen.'
|
|
}
|
|
}
|
|
}
|