My current challenge involves setting up the Jest test framework in my project, which utilizes Angular 14 and Ionic 6. I am also using other potentially conflicting plugins such as Firebase and Ngrx.
I have been primarily following this informative tutorial by Tim Deschryver, along with some additional resources like Stack Overflow to troubleshoot Jest testing errors. However, despite trying various solutions including starting fresh by removing packages and modifications, nothing seems to work.
You can find my updated repository here: https://github.com/neil89/igloo. In summary, some of the main modifications I made are listed below:
package.json
{
"name": "igloo",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
...
}
jest.config.js
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
globals: {...},
moduleNameMapper: {...},
...
}
setupJest.ts
import 'jest-preset-angular';
Here is an example of one of my failing tests:
app.component.spec.tsimport { TestBed } from '@angular/core/testing';
...
// Test cases go here
...
Upon running npm test
, I encountered the following output:
...
Detailed test results here
...
I would greatly appreciate any assistance or guidance on resolving this issue. It seems like there may be a configuration or initialization step that I have missed. Thank you!