Skip to content

Commit

Permalink
Fix jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Sep 29, 2023
1 parent 026d286 commit 12e75c9
Show file tree
Hide file tree
Showing 13 changed files with 15,008 additions and 12,478 deletions.
21 changes: 21 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
plugins: [
'@babel/plugin-transform-object-rest-spread',
'@babel/plugin-transform-runtime',
// [
// 'transform-imports',
// {
// '@patternfly/react-icons': {
// transform: (importName) =>
// `@patternfly/react-icons/dist/js/icons/${importName
// .split(/(?=[A-Z])/)
// .join('-')
// .toLowerCase()}`,
// preventFullImport: true,
// },
// },
// 'react-icons',
// ],
],
};
1 change: 0 additions & 1 deletion config/setupTestFramework.ts

This file was deleted.

2 changes: 1 addition & 1 deletion config/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import React from 'react';

declare const global;
global.React = React;
global.IS_REACT_ACT_ENVIRONMENT = true
global.IS_REACT_ACT_ENVIRONMENT = true;
27 changes: 22 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
module.exports = {
preset: 'ts-jest/presets/js-with-babel',
// transform: {
// // '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// // '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
// '^.+\\.[tj]sx?$': [
// 'ts-jest',
// {
// useESM: true,
// babelConfig: true,
// tsconfig: 'tsconfig.json',
// },
// ],
// },
testEnvironment: 'jsdom',
coverageDirectory: './coverage',
collectCoverageFrom: ['src/**/*.test.{ts,tsx}', '!**/node_modules/**', '!test/**'],
coveragePathIgnorePatterns: [],
// coverageDirectory: './coverage',
// collectCoverageFrom: ['src/**/*.test.{ts,tsx}', '!**/node_modules/**', '!test/**'],
// coveragePathIgnorePatterns: [],
setupFiles: ['<rootDir>/config/setupTests.ts'],
setupFilesAfterEnv: ['<rootDir>/config/setupTestFramework.ts'],
setupFilesAfterEnv: ['@testing-library/jest-dom/'],
roots: ['<rootDir>/src/'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/config/empty.js',
'\\.(svg)$': 'identity-obj-proxy',
'\\.(css|scss)$': 'identity-obj-proxy',
},
transformIgnorePatterns: ['node_modules/(?!@redhat-cloud-services|@openshift|lodash-es|uuid)'],
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!@redhat-cloud-services|@openshift|lodash-es|uuid|@patternfly/react-icons)',
// '<rootDir>/node_modules/@patternfly/react-icons',
],
};
Loading

0 comments on commit 12e75c9

Please sign in to comment.