Skip to content

Commit

Permalink
test and dependency cleanup for jest-config-stripes
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke committed Jul 27, 2023
1 parent 074b20f commit 763e85b
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 101 deletions.
33 changes: 5 additions & 28 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
// 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');

module.exports = {
collectCoverageFrom: [
'**/(lib|src)/**/*.{js,jsx}',
'!**/node_modules/**',
'!**/test/**',
...config,
setupFiles: [
...config.setupFiles,
path.join(__dirname, './test/jest/setupFiles.js'),
],
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',
'ky': 'ky/umd',
'uuid': require.resolve('uuid'), // https://github.com/uuidjs/uuid/issues/451
},
testEnvironment: 'jsdom',
testMatch: ['**/(lib|src)/**/?(*.)test.{js,jsx}'],
testPathIgnorePatterns: ['/node_modules/', '/test/ui-testing/', '/test/bigtest/'],
setupFiles: [path.join(__dirname, './test/jest/setupTests.js')],
setupFilesAfterEnv: [path.join(__dirname, './test/jest/jest.setup.js')],

roots: ['<rootDir>', './src'],
modulePaths: ['<rootDir>', './src'],
};
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
"babel-plugin-module-resolver": "^4.1.0",
"chai": "^4.1.2",
"eslint": "^7.32.0",
"eslint-plugin-jest-dom": "^4.0.2",
"eslint-plugin-testing-library": "^5.6.0",
"identity-obj-proxy": "^3.0.0",
"miragejs": "^0.1.32",
"moment": "^2.29.0",
Expand All @@ -66,8 +64,6 @@
"react-redux": "^8.0.5",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"sinon": "^7.3.2",
"sinon-chai": "^3.3.0",
"stylelint": "^8.2.0",
"stylelint-config-standard": "^17.0.0",
"stylelint-junit-formatter": "^0.2.1"
Expand Down
2 changes: 1 addition & 1 deletion src/components/About/AboutInstallMessages.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import { createMemoryHistory } from 'history';

import AboutInstallMessages, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from '@testing-library/react';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import { MemoryRouter } from 'react-router-dom';

import { ModulesContext } from '../../../ModulesContext';
Expand Down
1 change: 0 additions & 1 deletion src/components/OrganizationLogo/OrganizationLogo.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
}
}


@media (--medium-down) {
.logo {
margin-top: 0;
Expand Down
4 changes: 2 additions & 2 deletions src/components/StaleBundleWarning.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';

import { useQuery } from 'react-query';

Expand Down
2 changes: 1 addition & 1 deletion src/queries/useConfigurations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook, waitFor } from '@testing-library/react';
import { renderHook, waitFor } from '@folio/jest-config-stripes/testing-library/react';

import useConfigurations, { configurationsApi } from './useConfigurations';
import { useStripes } from '../StripesContext';
Expand Down
2 changes: 1 addition & 1 deletion src/queries/useOkapiEnv.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook, waitFor } from '@testing-library/react';
import { renderHook, waitFor } from '@folio/jest-config-stripes/testing-library/react';

import useOkapiEnv from './useOkapiEnv';
import { useStripes } from '../StripesContext';
Expand Down
17 changes: 0 additions & 17 deletions test/jest/babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/jest/helpers/renderWithRouter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { IntlProvider } from 'react-intl';
import { Router } from 'react-router-dom';
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import { createMemoryHistory } from 'history';
import componentsTranslations from '@folio/stripes-components/translations/stripes-components/en';
import stripesCoreTranslations from '../../../translations/stripes-core/en';
Expand Down
5 changes: 0 additions & 5 deletions test/jest/jest-transformer.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/jest/jest.setup.js

This file was deleted.

File renamed without changes.
37 changes: 0 additions & 37 deletions test/jest/turn-off-warnings.js

This file was deleted.

0 comments on commit 763e85b

Please sign in to comment.