Skip to content

Commit

Permalink
UIDATIMP-1508: leverage jest-config-stripes for all jest and testing-…
Browse files Browse the repository at this point in the history
…library packages (#1451)
  • Loading branch information
mariia-aloshyna authored Sep 14, 2023
1 parent 5d9cbf9 commit 9752f4a
Show file tree
Hide file tree
Showing 136 changed files with 140 additions and 185 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Landing page: Create hotlink from job profile name in log to the job profile details (UIDATIMP-1355)
* Create hotlink from file name in job profile detail view to job log details (UIDATIMP-1356)
* Add accessibility testing to automated tests in ui-data-import (UIDATIMP-1372)
* Provide "required" field for notes and electronic access subfields in field mapping (UIDATIMP-1384)
* Avoid private paths in stripes-core imports (UIDATIMP-1414)
* Order field mapping: Add info icon to the Acq unit field (UIDATIMP-1426)
* Invoice field mapping: Add info icon to the Acq unit field (UIDATIMP-1427)
Expand All @@ -26,7 +27,7 @@
* Change validation messages which were represented in code format (UIDATIMP-1473)
* *BREAKING* bump `react` to `v18`, and dev-deps accordingly (UIDATIMP-1485)
* Update Node.js to v18 in GitHub Actions (UIDATIMP-1507)
* Provide "required" field for notes and electronic access subfields in field mapping (UIDATIMP-1384)
* leverage jest-config-stripes for all jest and testing-library packages (UIDATIMP-1508)
* *BREAKING* bump `react-intl` to `v6.4.4` (UIDATIMP-1520)

### Bugs fixed:
Expand Down
26 changes: 5 additions & 21 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const path = require('path');

const esModules = ['@folio', 'ky', 'uuid'].join('|');
const config = require('@folio/jest-config-stripes');
const acqConfigs = require('@folio/stripes-acq-components/jest.config');

module.exports = {
collectCoverageFrom: [
'**/(lib|src)/**/*.{js,jsx}',
'!**/node_modules/**',
'!**/test/**',
],
coverageDirectory: './artifacts/coverage-jest/',
coverageReporters: ['lcov'],
reporters: ['jest-junit', 'default'],
transform: { '^.+\\.(js|jsx)$': path.join(__dirname, './test/jest/jest-transformer.js') },
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
moduleNameMapper: {
'^.+\\.(css)$': 'identity-obj-proxy',
'^.+\\.(svg)$': 'identity-obj-proxy',
...config,
transform: {
...acqConfigs.transform,
},
testEnvironment: 'jsdom',
testMatch: ['**/(lib|src)/**/?(*.)test.{js,jsx}'],
testPathIgnorePatterns: ['/node_modules/'],
setupFilesAfterEnv: [path.join(__dirname, './test/jest/jest.setup.js')],
};
17 changes: 3 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
"devDependencies": {
"@babel/core": "^7.17.12",
"@babel/eslint-parser": "^7.17.0",
"@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/plugin-transform-class-properties": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.10.5",
"@babel/preset-react": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.22.15",
"@folio/eslint-config-stripes": "^7.0.0",
"@folio/jest-config-stripes": "^2.0.0",
"@folio/stripes": "^9.0.0",
"@folio/stripes-cli": "^3.0.0",
"@folio/stripes-components": "~12.0.0",
Expand All @@ -35,9 +33,6 @@
"@folio/stripes-smart-components": "~9.0.0",
"@folio/stripes-testing": "^4.5.0",
"@formatjs/cli": "^6.1.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^14.0.0",
"babel-jest": "^29.6.1",
"babel-polyfill": "^6.26.0",
"chai": "^4.2.0",
"eslint": "^7.32.0",
Expand All @@ -49,10 +44,6 @@
"eslint-plugin-react-hooks": "^1.7.0",
"faker": "^4.1.0",
"history": "^5.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.5.0",
"jest-junit": "^16.0.0",
"mocha": "^9.0.0",
"query-string": "^5.0.0",
"react": "^18.2.0",
Expand All @@ -62,9 +53,7 @@
"react-redux": "^8.0.5",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"redux": "^4.0.5",
"regenerator-runtime": "^0.13.9",
"sinon": "^7.2.2"
"redux": "^4.0.5"
},
"dependencies": {
"@folio/stripes-acq-components": "~5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { waitFor } from '@testing-library/react';
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionMenu/ActionMenu.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import '../../../test/jest/__mock__';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionMenu/ItemTemplates/Default.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionMenu/ItemTemplates/LinkTo.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { createMemoryHistory } from 'history';
import { Router } from 'react-router-dom';
import { runAxeTest } from '@folio/stripes-testing';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionMenu/menuTemplate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {
render,
fireEvent,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import '../../../test/jest/__mock__';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodeHighlight/CodeHighlight.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import { CodeHighlight } from './CodeHighlight';
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataFetcher/DataFetcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import {
render,
waitFor,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import { buildResources } from '@folio/stripes-data-transfer-components/test/helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';
import { noop } from 'lodash';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { waitFor } from '@testing-library/react';
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FieldOrganization/FieldOrganization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
act,
waitFor,
fireEvent,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import '../../../test/jest/__mock__';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ImportJobs/ImportJobs.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { waitFor } from '@testing-library/react';
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
import { noop } from 'lodash';
import { runAxeTest } from '@folio/stripes-testing';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { noop } from 'lodash';
import { runAxeTest } from '@folio/stripes-testing';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Jobs/Jobs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
fireEvent,
waitFor,
within,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListView/ListView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BrowserRouter as Router } from 'react-router-dom';
import {
fireEvent,
waitFor,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import faker from 'faker';
import { noop } from 'lodash';
import { createMemoryHistory } from 'history';
Expand Down
2 changes: 1 addition & 1 deletion src/components/LogViewer/LogViewer.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MARCTable/MARCTable.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MARCTable/MARCTableRow.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { waitFor } from '@testing-library/react';
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsList/OptionsList.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
waitFor,
fireEvent,
act,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import '../../../../test/jest/__mock__';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileTree/ProfileBranch.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileTree/ProfileLabel.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import '../../../../test/jest/__mock__';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileTree/ProfileTree.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {
fireEvent,
waitFor,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { noop } from 'lodash';
import { runAxeTest } from '@folio/stripes-testing';

Expand Down
2 changes: 1 addition & 1 deletion src/components/RecordTypesSelect/RecordTypesSelect.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { noop } from 'lodash';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import { Triangle } from './Triangle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchAndSort/SearchAndSort.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
fireEvent,
waitFor,
render,
} from '@testing-library/react';
} from '@folio/jest-config-stripes/testing-library/react';
import { noop } from 'lodash';
import { runAxeTest } from '@folio/stripes-testing';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Section/Section.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { fireEvent } from '@folio/jest-config-stripes/testing-library/react';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand Down
Loading

0 comments on commit 9752f4a

Please sign in to comment.