invertase / react-native-notifee

Moved to https://github.com/invertase/notifee
https://invertase.io/blog/open-sourcing-notifee
Other
465 stars 31 forks source link

Add <rootDir> to relative path in jest config #309

Closed mars-lan closed 3 years ago

mars-lan commented 3 years ago

Jest seems to expect this as without the leading ./ it leads to the following error

● Validation Error:

  Module node_modules/@notifee/react-native/jest-mock.js in the setupFilesAfterEnv option was not found.
         <rootDir> is: <project root>

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html
CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

mikehardy commented 3 years ago

Hmm - I wonder if it might be better as <rootDir>/node_modules/@notifee/react-native/jest-mock.js - have you tried that @mars-lan ? Seems better because then it might work in a mono-repo where it was hoisted or similar, basically all the cases that caused the rootDir variable to exist in jest config ?

mars-lan commented 3 years ago

@mikehardy thanks for the suggestion. <rootDir> was indeed suggested by the doc: https://jestjs.io/docs/configuration#setupfilesafterenv-array

helenaford commented 3 years ago

Thanks @mars-lan for this. Not going to merge this yet until we have a solid mock file with all the methods needed. I've updated the README to make sure no one tries to use it yet.

helenaford commented 3 years ago

Thanks @mars-lan for your help. Will close this as I've merged a fix in with the updated jest mock.