Skip to content

Commit

Permalink
chore(jest): Fix Jest Deprecation Warnings (#465)
Browse files Browse the repository at this point in the history
* fix jest warning

          Importing "setup-jest.js" directly is deprecated. The file "setup-jest.js" will be removed in the future.
          Please use "setupZoneTestEnv" function instead. Example:

          // setup-jest.ts
          import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';

          setupZoneTestEnv();

* fix another jest deprecation warning

ts-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated. Please do
transform: {
    <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
},
See more at https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced
ts-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated. Please do
transform: {
    <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
},

* update package-lock.json

* update jest config
  • Loading branch information
hf-krechan authored Feb 19, 2025
1 parent e66c942 commit de0d859
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
20 changes: 12 additions & 8 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/src/setup-jest.ts"],
"globals": {
"ts-jest": {
"tsconfig": "<rootDir>/tsconfig.spec.json",
"stringifyContentPathRegex": "\\.html$"
}
"transform": {
"^.+\\.(ts|html)$": [
"jest-preset-angular",
{
"tsconfig": "<rootDir>/tsconfig.spec.json",
"stringifyContentPathRegex": "\\.html$"
}
]
},
"moduleNameMapper": {
"^lodash-es$": "lodash"
},
"coverageReporters": ["json", "html"],
"coverageDirectory": "coverage/api-documentation-portal",
"displayName": "ap-ui-example-app",
"coverageDirectory": "coverage/ahb-tabellen",
"displayName": "ahb-tabellen",
"modulePathIgnorePatterns": ["<rootDir>/dist"],
"transformIgnorePatterns": ["/node_modules/?!@angular"]
"transformIgnorePatterns": ["node_modules/(?!.*\\.mjs$|@angular|rxjs)"],
"testEnvironment": "jsdom"
}
3 changes: 0 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/setup-jest.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import 'jest-preset-angular/setup-jest';
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';

setupZoneTestEnv();

0 comments on commit de0d859

Please sign in to comment.