Skip to content

Commit

Permalink
Add sonarcloud coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
w3nl committed Nov 1, 2021
1 parent 396aaed commit 7f4cde5
Show file tree
Hide file tree
Showing 8 changed files with 1,829 additions and 2,291 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [12.x, 14.x, 16.x, 17.x]

steps:
- uses: actions/checkout@v1
Expand All @@ -21,7 +21,13 @@ jobs:
run: |
npm ci
npm run vulnerabilities
npm run cpd
npm run lint
npm test
env:
CI: true
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 changes: 12 additions & 5 deletions .jscpd.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"threshold": 0,
"reporters": ["json", "console"],
"ignore": ["**/__snapshots__/**"],
"absolute": true,
"gitignore": true
"threshold": 0,
"reporters": [
"json",
"console"
],
"ignore": [
"**/__snapshots__/**",
"**/__fixtures__/**",
"**/__tests__/**"
],
"absolute": true,
"gitignore": true
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_js:
- "12"
- "14"
- "16"
- "17"
before_script:
- npm run lint
after_script:
Expand Down
2 changes: 2 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ module.exports = {

collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],

testResultsProcessor: 'jest-sonar-reporter',
};
4,059 changes: 1,776 additions & 2,283 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@hckrnews/objects",
"description": "Create valid JavaScript objects",
"version": "3.3.5",
"version": "3.3.6",
"author": {
"name": "Pieter Wigboldus",
"url": "https://hckr.news/"
},
"license": "LGPL-3.0",
"scripts": {
"lint": "eslint src/*.js --config .eslintrc",
"lint": "eslint src/*.js --config .eslintrc -f json -o report.json",
"lint:fix": "eslint src/*.js --config .eslintrc --fix",
"test": "jest",
"test:watch": "jest src --watch",
Expand Down Expand Up @@ -42,6 +42,7 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^27.2.4",
"jest-sonar-reporter": "^2.0.0",
"jscpd": "^3.2.1",
"prettier": "^2.2.1"
},
Expand Down
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.organization=hckrnews
sonar.projectKey=hckrnews_objects

# relative paths to source directories. More details and properties are described
# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/
sonar.sources=.
sonar.exclusions=**/__tests__/*.js
sonar.language=js
sonar.tests=./src/__tests__

sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./test-report.xml

sonar.sourceEncoding=UTF-8
14 changes: 14 additions & 0 deletions sonarcloud-jest-sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.organization=hckrnews
sonar.projectKey=hckrnews_objects

# relative paths to source directories. More details and properties are described
# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/
sonar.sources=.
sonar.exclusions=**/__tests__/*.js
sonar.language=js
sonar.tests=./src/__tests__

sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./test-report.xml

sonar.sourceEncoding=UTF-8

0 comments on commit 7f4cde5

Please sign in to comment.