Skip to content

Commit 851a12f

Browse files
fix: add extendJestConfig helper function
1 parent 8a8dcf9 commit 851a12f

6 files changed

Lines changed: 16 additions & 15 deletions

File tree

common/extendJestConfig.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const extendJestConfig = (config) => {
2+
const modulePathsToIgnore = ['<rootDir>/dist'];
3+
config.modulePathIgnorePatterns = config.modulePathIgnorePatterns ? [...config.modulePathIgnorePatterns, ...modulePathsToIgnore] : modulePathsToIgnore;
4+
config.moduleNameMapper = {
5+
...config.moduleNameMapper,
6+
"@edx/frontend-enterprise-(.*)": "<rootDir>/../$1/src",
7+
};
8+
};
9+
10+
module.exports = extendJestConfig;
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
const path = require('path');
21
const { createConfig } = require('@edx/frontend-build');
2+
const extendJestConfig = require('../../common/extendJestConfig');
33

44
const config = createConfig('jest');
5-
6-
config.modulePathIgnorePatterns = ['<rootDir>/dist'];
7-
config.moduleNameMapper = {
8-
'@edx/frontend-enterprise-utils': path.resolve(__dirname, '../utils/src'),
9-
};
10-
// config.transformIgnorePatterns = ["node_modules/(?!(@edx/frontend-enterprise-utils)/)"];
5+
extendJestConfig(config);
116

127
module.exports = config;

packages/catalog-search/src/tests/SearchContext.test.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe('getRefinementsToSet', () => {
1313
subject: ['science', 'math'],
1414
language: ['english'],
1515
};
16-
expect(true).toBe(false);
1716
expect(getRefinementsToSet(queryParams, activeFacetAttributes)).toEqual(expectedRefinements);
1817
});
1918
it('converts boolean query params to a number', () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { createConfig } = require('@edx/frontend-build');
2+
const extendJestConfig = require('../../common/extendJestConfig');
23

34
const config = createConfig('jest');
4-
5-
config.modulePathIgnorePatterns = ['<rootDir>/dist'];
5+
extendJestConfig(config);
66

77
module.exports = config;

packages/utils/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { createConfig } = require('@edx/frontend-build');
2+
const extendJestConfig = require('../../common/extendJestConfig');
23

34
const config = createConfig('jest');
4-
5-
config.modulePathIgnorePatterns = ['<rootDir>/dist'];
5+
extendJestConfig(config);
66

77
module.exports = config;

packages/utils/src/hooks.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
44
import getLearnerPortalLinks from './learnerPortalLinks';
55

66
export const useIsFirstRender = () => {
7-
console.log('useIsFirstRender');
8-
throw new Error('huzzah!');
9-
107
const isMountRef = useRef(true);
118
useEffect(() => {
129
isMountRef.current = false;

0 commit comments

Comments
 (0)