kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

feat: Update to Angular 16 #2010

Closed HendrikJanssen closed 1 year ago

HendrikJanssen commented 1 year ago
changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 09e2a8703bc92668ba02a18bc2bf0f5898b8e68b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

HendrikJanssen commented 1 year ago

It seems the moduleNameMapper config option in jest.config.js was misconfigured and failed to execute tests when importing from the "compiled" module. I fixed it by using

moduleNameMapper: {
    '^apollo-angular': '<rootDir>/src/',
}

Instead of

moduleNameMapper: {
    '^apollo-angular': '<rootDir>',
}

While at it, I removed the absolute path for the resolver option (unnecessary) and migrated the "ts-jest" config options to be included in the transform options of jest-preset-angular as detailed in https://thymikee.github.io/jest-preset-angular/docs/getting-started/options#exposed-configuration since the globals way of doing it is deprecated.

HendrikJanssen commented 1 year ago

Alright, the demoproject had trouble building: "Module apollo-angular could not be found".

I fixed it by pointing the paths option in the tsconfig.app.json to the built apollo-angular package, since pointing it to src/ would surface some compilation errors because of typescript. That does actually seem like a dirty hack though, not sure how module resolution worked before that, could you point me in the right direction @PowerKiKi ?

PowerKiKi commented 1 year ago

Actually your workaround makes sense to me. And I don't have any specific knowledge to share about how it used to work before.

@kamilkisiela do you have any insight regarding module resolutions ?