app-config icon indicating copy to clipboard operation
app-config copied to clipboard

Explore creating a Jest plugin

Open joelgallant opened this issue 4 years ago • 2 comments

I would rather not point to "just mock the module" when asked how to test app-config.

joelgallant avatar Feb 13 '21 19:02 joelgallant

the documentation currently says that

In Node.js, App Config might work without any configuration.

however this doesn't seem to be the case. as far as i can tell, it's impossible to load app-config in jest. calling loadConfig in setupFiles or globalSetup don't seem to work

DetachHead avatar Apr 26 '21 16:04 DetachHead

I think something like this is required - https://github.com/facebook/jest/issues/949

Or, following https://github.com/facebook/jest/issues/11038#issuecomment-770182413

In my experience, I've tended to either loadConfig explicitly in beforeEach, or jest.mock'ed.

I'm still quite interested in providing a jest plugin to make this plug-and-play.

joelgallant avatar Apr 26 '21 19:04 joelgallant