Skip to content

Commit

Permalink
VSTS-201 / VSTS-192 - Added code coverage and fixed unit test error.
Browse files Browse the repository at this point in the history
QA Hardening
  • Loading branch information
mickael-caro-sonarsource committed Jul 31, 2019
2 parents 9997c1b + 9187a10 commit 8570554
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cache:
install:
- npm install
- npm run install-dep
before_script: npm run clean && npm run validate
before_script: npm run clean && npm run validate-ci
script:
- if [ -n "$ARTIFACTORY_URL" ]; then npm run deploy; fi
- git fetch --unshallow && npm run sonarqube
Expand Down
2 changes: 2 additions & 0 deletions common/ts/__tests__/publish-task-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ it('task should not fail the task even if all ceTasks timeout', async () => {
.spyOn(serverUtils, 'publishBuildSummary')
.mockImplementation(() => null);

jest.spyOn(Metrics, 'getAllMetrics').mockImplementation(() => METRICS);

await publishTask.default(EndpointType.SonarCloud);

expect(serverUtils.publishBuildSummary).toHaveBeenCalledTimes(1);
Expand Down
2 changes: 1 addition & 1 deletion config/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ exports.runSonnarQubeScanner = function(callback, options = {}) {
'sonar.exclusions':
'build/**, coverage/**, node_modules/**, **/node_modules/**, **/__tests__/**',
'sonar.coverage.exclusions':
'gulpfile.js, build/**, config/**, coverage/**, scripts/**, **/__tests__/**',
'gulpfile.js, build/**, config/**, coverage/**, extensions/**, scripts/**, **/__tests__/**',
'sonar.tests': '.',
'sonar.test.inclusions': '**/__tests__/**',
'sonar.analysis.buildNumber': process.env.TRAVIS_BUILD_NUMBER,
Expand Down
29 changes: 14 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"prettier": "1.12.1",
"request": "2.85.0",
"semver": "5.5.0",
"sonarqube-scanner": "2.1.2",
"tfx-cli": "^0.7.6",
"sonarqube-scanner": "2.5.0",
"tfx-cli": "0.7.8",
"tmp": "0.0.33",
"ts-jest": "22.4.4",
"typescript": "2.8.3",
Expand All @@ -53,25 +53,23 @@
"lint-report": "eslint --ext js,ts -f json -o eslint-report.json \"{common,extensions}/**/*.{js,ts}\"",
"test-build": "./node_modules/.bin/gulp build:test",
"test": "./node_modules/.bin/jest",
"test-ci": "./node_modules/.bin/jest --coverage",
"ts-check": "./node_modules/.bin/tsc --noEmit",
"validate": "npm run lint && npm run ts-check && npm run format-check && npm run test",
"validate-ci": "npm run lint-report && npm run ts-check && npm run format-check && npm run test --ci --coverage --runInBand"
"validate-ci": "npm run lint-report && npm run ts-check && npm run format-check && npm run test-ci"
},
"engines": {
"node": ">=6"
},
"jest": {
"clearMocks": true,
"collectCoverageFrom": [
"**/*.ts"
"{common}**/*.ts"
],
"coveragePathIgnorePatterns": [
"gulpfile.js",
"__tests__/",
"/node_modules",
"/config",
"/scripts",
"/build"
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": [
"lcovonly",
"text"
],
"moduleFileExtensions": [
"ts",
Expand Down

0 comments on commit 8570554

Please sign in to comment.