Skip to content

Commit

Permalink
feat(jest): coverage reports for js unit tests (openemr#6735)
Browse files Browse the repository at this point in the history
* feat(jest): coverage reports for js unit tests

* test(ccdaservice): test data return for empty stack
  • Loading branch information
raskolnikov-rodion authored Aug 12, 2023
1 parent 1982551 commit 0527d8e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ ccdaservice/node_modules

# testing
.phpunit.result.cache
coverage/js-unit
1 change: 1 addition & 0 deletions ccdaservice/data-stack/data-stack.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('DataStack', () => {
});

it('should store and return data', () => {
expect(stack.returnData()).toEqual(null);
const hello = 'Hello';
const world = 'World!';
stack.push(hello + delimiter);
Expand Down
22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ const config = {
modulePathIgnorePatterns: [
'public/assets',
'vendor'
],
coverageDirectory: 'coverage/js-unit',
collectCoverageFrom: ['**/*.js'],
coveragePathIgnorePatterns: [
'gulpfile.js',
'jest.config.js',
'node_modules',
'ccdaservice/node_modules',
'coverage',
'interface/forms/eye_mag/js/jquery-1-10-2',
'interface/forms/eye_mag/js/jquery-panelslider',
'interface/forms/eye_mag/js/jquery-ui-1-11-4',
'interface/forms/eye_mag/js/jquery-1-10-2',
'interface/forms/questionnaire_assessments/lforms/fhir',
'interface/forms/questionnaire_assessments/lforms/webcomponent',
'interface/modules/zend_modules/public/js/lib',
'interface/super/rules/www/js/cdr-multiselect',
'portal/patient/scripts/libs',
'public/assets',
'swagger',
'tests',
'vendor'
]
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint:js": "eslint '**/*.js' --quiet",
"lint:js-fix": "npm run lint:js -- --fix",
"test:js": "jest"
"test:js": "jest",
"test:js-coverage": "jest --coverage"
},
"keywords": [
"openemr"
Expand Down

0 comments on commit 0527d8e

Please sign in to comment.