Whenever I try to execute something in jest, I keep encountering the same error message:
console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Not implemented: window.alert
at module.exports (D:\Docs\Projects\EMM\emm_next\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\browser\not-implemented.js:9:17)
at D:\Docs\Projects\EMM\emm_next\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\browser\Window.js:594:7
at util_ajvSchemaValidator (D:\Docs\Projects\EMM\emm_next\src\utils\commonUtility.ts:1557:5)
at Object.<anonymous> (D:\Docs\Projects\EMM\emm_next\tests\unit\utils\commonUtility.test.ts:78:30)
at Object.asyncJestTest (D:\Docs\Projects\EMM\emm_next\node_modules\jest-jasmine2\build\jasmine_async.js:108:37)
at D:\Docs\Projects\EMM\emm_next\node_modules\jest-jasmine2\build\queue_runner.js:56:12
at new Promise (<anonymous>)
at mapper (D:\Docs\Projects\EMM\emm_next\node_modules\jest-jasmine2\build\queue_runner.js:43:19)
at D:\Docs\Projects\EMM\emm_next\node_modules\jest-jasmine2\build\queue_runner.js:87:41
at processTicksAndRejections (internal/process/task_queues.js:94:5) undefined
console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Not implemented: window.print
at module.exports (D:\Docs\Projects\EMM\emm_next\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\browser\not-implemented.js:9:17)
at D:\Docs\Projects\EMM\emm_next\node_modules\jest-environment-jsdom\node_modules\jsdom\lib\jsdom\browser\Window.js:594:7
at Object.<anonymous> (D:\Docs\Projects\EMM\emm_next\tests\unit\utils\commonUtility.test.ts:127:5)
at Object.asyncJestTest (D:\Docs\Projects\EMM\emm_next\node_modules\jest-jasmine2\build\jasmine_async.js:108:37)
FAIL tests/unit/utils/commonUtility.test.ts (6.407s)jest-jasmine2\build\queue_runner.js:56:12
util_sum
I attempted to resolve the issue by installing npm i jsdom, but unfortunately, the problem persists. I even added "testEnvironment": "jsdom" to the package.json file, but the issue remains. Is there a proper solution to fix this error?