Skip to content

Commit 5283e2b

Browse files
committed
Refactor: Improve testing and code coverage
1 parent 5f0ab1d commit 5283e2b

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Jenkinsfile

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,36 @@ pipeline {
2929
script {
3030
sh 'echo "Linting..."'
3131
sh 'npm install -g eslint'
32-
sh 'eslint --init --max-errors=0 --max-warnings=3 --fix'
32+
sh 'eslint --max-errors=0 --max-warnings=3 --fix .'
3333
}
3434
}
3535
}
3636
stage('Test') {
3737
steps {
3838
script {
3939
sh 'echo "Testing..."'
40-
sh 'NODE_OPTIONS="--max-old-space-size=4096" npm test --verbose --maxWorkers=2 --coverage --coverageReporters=text-lcov --outputFile=coverage/lcov.info'
40+
sh 'NODE_OPTIONS="--max-old-space-size=4096" npm test --verbose --maxWorkers=2 --coverage --coverageReporters=cobertura --outputFile=coverage/cobertura-coverage.xml'
41+
}
42+
recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'coverage/cobertura-coverage.xml']], sourceCodeRetention: 'EVERY_BUILD')
43+
}
44+
}
45+
stage('Publish Coverage') {
46+
steps {
47+
script {
48+
sh 'echo "Publishing Coverage..."'
49+
sh 'npm install -g coveralls'
50+
sh 'coveralls < coverage/lcov.info'
51+
}
52+
}
53+
}
54+
stage('SonarQube') {
55+
steps {
56+
script {
57+
sh 'echo "SonarQube..."'
58+
sh 'npm install -g sonarqube-scanner'
59+
withSonarQubeEnv('SonarQube') {
60+
sh 'sonar-scanner'
61+
}
4162
}
4263
}
4364
}

0 commit comments

Comments
 (0)