Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Consume jest-config-terra (#1387)
Browse files Browse the repository at this point in the history
* Consume jest-config-terra

* remove un-needed config

* All the change logs

* Consume released package
  • Loading branch information
mjhenkes authored Mar 24, 2021
1 parent da8e187 commit 45ad1d9
Show file tree
Hide file tree
Showing 79 changed files with 189 additions and 159 deletions.
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const jestConfig = require('@cerner/jest-config-terra');

module.exports = {
...jestConfig,
setupFiles: [
'./jest.enzymeSetup.js',
],
snapshotSerializers: [
'enzyme-to-json/serializer',
],
};
10 changes: 10 additions & 0 deletions jest.enzymeSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Make Enzyme functions available in all test files without importing
/* eslint-disable import/no-extraneous-dependencies */
import Enzyme, { mount, render, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });

global.shallow = shallow;
global.render = render;
global.mount = mount;
13 changes: 0 additions & 13 deletions jestBabelTransform.js

This file was deleted.

6 changes: 0 additions & 6 deletions jestGlobalSetup.js

This file was deleted.

30 changes: 0 additions & 30 deletions jestconfig.js

This file was deleted.

26 changes: 0 additions & 26 deletions jestsetup.js

This file was deleted.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"docs": "node scripts/root-readme-updater/index.js",
"docs:peerDependencies": "node scripts/peer-dependency-generator/index.js",
"heroku-postbuild": "npm install --only=dev && npm run compile:prod",
"jest": "jest --config jestconfig.js",
"jest:coverage": "jest --coverage --config jestconfig.js",
"jest": "jest",
"jest:coverage": "jest --coverage",
"link-parent-bin": "link-parent-bin",
"lint": "npm run lint:js && npm run lint:scss",
"lint:js": "eslint --ext .js,.jsx .",
Expand Down Expand Up @@ -85,12 +85,12 @@
"@babel/preset-react": "^7.0.0",
"@cerner/browserslist-config-terra": "^3.1.0",
"@cerner/eslint-config-terra": "^5.0.0",
"@cerner/jest-config-terra": "^1.0.0",
"@cerner/stylelint-config-terra": "^4.0.0",
"@cerner/terra-cli": "^1.1.0",
"@cerner/terra-functional-testing": "^1.0.1",
"@cerner/terra-open-source-scripts": "^1.1.0",
"@cerner/webpack-config-terra": "^1.0.0",
"babel-jest": "^24.8.0",
"check-installed-dependencies": "^1.0.0",
"core-js": "^3.1.3",
"danger": "^9.1.0",
Expand All @@ -100,15 +100,12 @@
"eslint": "^7.19.0",
"gh-pages": "^2.0.1",
"glob": "^7.1.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.8.0",
"jest": "^26.6.3",
"lerna": "^3.16.4",
"link-parent-bin": "^1.0.0",
"postcss": "^8.2.1",
"raf": "^3.4.1",
"react": "^16.8.5",
"react-dom": "^16.8.5",
"react-test-renderer": "^16.4.2",
"regenerator-runtime": "^0.13.2",
"stylelint": "^13.0.0",
"terra-aggregate-translations": "^1.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/terra-abstract-modal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* updated jest tests to not expect a mock to cross it blocks.

## 3.32.0 - (March 9, 2021)

* Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-abstract-modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
34 changes: 8 additions & 26 deletions packages/terra-abstract-modal/tests/jest/inertHelpers.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,23 @@ describe('showModalDomUpdates', () => {
});

describe('when inert has not been set on root', () => {
beforeAll(() => {
showModalDomUpdates(mockModalElement, '#root');
});

it('sets inert on root', () => {
showModalDomUpdates(mockModalElement, '#root');
expect(mockSetAttribute).toHaveBeenNthCalledWith(1, 'inert', 'true');
});

it('sets modal-overlay count to 1', () => {
// sets modal-overlay count to 1', () => {
expect(mockSetAttribute).toHaveBeenNthCalledWith(2, 'data-abstract-modal-overlay-count', '1');
});
});

describe('when inert has already been set on root', () => {
beforeAll(() => {
jest.clearAllMocks();
it('does not resets inert on root', () => {
mockGetAttribute.mockReturnValue('1');

showModalDomUpdates(mockModalElement, '#root');
});

it('does not resets inert on root', () => {
expect(mockSetAttribute).not.toHaveBeenNthCalledWith(1, 'inert', 'true');
});

it('sets modal-overlay count to 1', () => {
// sets modal-overlay count to 1
expect(mockSetAttribute).toHaveBeenNthCalledWith(1, 'data-abstract-modal-overlay-count', '2');
});
});
Expand Down Expand Up @@ -98,32 +89,23 @@ describe('hideModalDomUpdates', () => {
});

describe('when inert has been set once on root', () => {
beforeAll(() => {
hideModalDomUpdates(mockModalTriggerElement, '#root');
});

it('removes modal-overlay count', () => {
hideModalDomUpdates(mockModalTriggerElement, '#root');
expect(mockRemoveAttribute).toHaveBeenNthCalledWith(1, 'data-abstract-modal-overlay-count');
});

it('removes inert on root', () => {
// removes inert on root
expect(mockRemoveAttribute).toHaveBeenNthCalledWith(2, 'inert');
});
});

describe('when inert has been set multiple times on root', () => {
beforeAll(() => {
jest.clearAllMocks();
it('reduces the modal-overlay count to 1', () => {
mockGetAttribute.mockReturnValue('2');

hideModalDomUpdates(mockModalTriggerElement, '#root');
});

it('reduces the modal-overlay count to 1', () => {
expect(mockSetAttribute).toHaveBeenNthCalledWith(1, 'data-abstract-modal-overlay-count', '1');
});

it('does not remove inert on root', () => {
// does not remove inert on root
expect(mockRemoveAttribute).not.toHaveBeenNthCalledWith(1, 'inert');
});
});
Expand Down
5 changes: 4 additions & 1 deletion packages/terra-aggregator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 4.66.0 - (March 9, 2021)

* Changed
Expand Down Expand Up @@ -36,7 +39,7 @@

* Changed
* Update wdio tests to remove deprecated Terra.it helpers

## 4.59.0 - (November 10, 2020)

* Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-aggregator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
3 changes: 3 additions & 0 deletions packages/terra-application-header-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 3.33.0 - (March 9, 2021)

* Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-application-header-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
5 changes: 4 additions & 1 deletion packages/terra-application-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 5.52.0 - (March 9, 2021)

* Changed
Expand Down Expand Up @@ -40,7 +43,7 @@

* Changed
* Update wdio tests to remove deprecated Terra.it helpers

## 5.45.0 - (November 10, 2020)

* Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-application-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
7 changes: 5 additions & 2 deletions packages/terra-application-links/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 6.49.0 - (March 9, 2021)

* Changed
Expand Down Expand Up @@ -35,7 +38,7 @@

* Changed
* Update wdio tests to remove deprecated Terra.it helpers

## 6.43.0 - (November 10, 2020)

* Fixed
Expand All @@ -58,7 +61,7 @@

* Changed
* Updated Changelog format

## 6.39.0 - (August 11, 2020)

* Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-application-links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
3 changes: 3 additions & 0 deletions packages/terra-application-menu-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 3.28.0 - (March 9, 2021)

* Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-application-menu-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
5 changes: 4 additions & 1 deletion packages/terra-application-name/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Updated Jest command

## 3.36.0 - (March 9, 2021)

* Changed
Expand All @@ -21,7 +24,7 @@

* Added
* Added missing themeable variables.

## 3.32.0 - (August 4, 2020)

* Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-application-name/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run lint && npm run jest && npm run wdio",
"jest": "jest --config ../../jestconfig.js",
"jest": "jest --config ../../jest.config.js",
"wdio-default": "cd ../.. && npx wdio",
"wdio-lowlight": "cd ../.. && THEME=clinical-lowlight-theme npx wdio",
"wdio-fusion": "cd ../.. && THEME=orion-fusion-theme npx wdio",
Expand Down
Loading

0 comments on commit 45ad1d9

Please sign in to comment.