Skip to content

Commit

Permalink
deps: update jest and fix issues
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Jest upgrade to version 28, the jest-marbles package has been replaced by jasmine-marbles.
  • Loading branch information
MaxKless authored and SGrueber committed Jul 19, 2022
1 parent 215525e commit 8087fa7
Show file tree
Hide file tree
Showing 48 changed files with 2,755 additions and 3,197 deletions.
3 changes: 3 additions & 0 deletions docs/guides/migrations.md
Expand Up @@ -9,6 +9,9 @@ kb_sync_latest_only

## 2.4 to 3.0

The Intershop PWA 3.0 release includes a Jest Update to version 28, see also https://jestjs.io/docs/upgrading-to-jest28.
The jest-marbles package has been replaced by jasmine-marbles.

Since the used deferred load library is no longer maintained it is removed and replaced with similar standard browser functionality [`loading="lazy"`](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#images_and_iframes).
All uses of the `(deferLoad)` directive in custom code need to be replaced.

Expand Down
15 changes: 0 additions & 15 deletions jest.config.haste-map.js

This file was deleted.

19 changes: 9 additions & 10 deletions jest.config.js
@@ -1,9 +1,3 @@
const path = require('path');
const fs = require('fs');
const { pathsToModuleNameMapper } = require('ts-jest');

const tsConfig = require('comment-json').parse(fs.readFileSync('./tsconfig.json', { encoding: 'utf-8' }));

const esModules = ['lodash-es/.*', 'swiper', 'ssr-window', 'dom7', '.*\\.mjs$'];

module.exports = {
Expand All @@ -18,14 +12,19 @@ module.exports = {
roots: ['src', 'projects'],
setupFilesAfterEnv: ['<rootDir>/src/setupJest.ts'],
transformIgnorePatterns: [`node_modules/(?!${esModules.join('|')})`],
moduleNameMapper: pathsToModuleNameMapper(tsConfig.compilerOptions.paths, { prefix: '<rootDir>' }),
moduleNameMapper: {
'^ish-(.*)$': '<rootDir>/src/app/$1',
'^organization-management$': '<rootDir>/projects/organization-management/src/app/exports',
'^requisition-management$': '<rootDir>/projects/requisition-management/src/app/exports',
// This forces jest to use a Node+CommonJS version of uuid. Refer to the following resources for more info:
// https://github.com/uuidjs/uuid/pull/616
// https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149
'^uuid$': require.resolve('uuid'),
},
snapshotSerializers: [
'./src/jest-serializer/AngularHTMLSerializer.js',
'./src/jest-serializer/CategoryTreeSerializer.js',
'./src/jest-serializer/NgrxActionSerializer.js',
'./src/jest-serializer/NgrxActionArraySerializer.js',
],
haste: {
hasteMapModulePath: path.join(__dirname, 'jest.config.haste-map.js'),
},
};

0 comments on commit 8087fa7

Please sign in to comment.