Replacement for `require.context` when running Jest Replacement for `require.context` when running Jest vue.js vue.js

Replacement for `require.context` when running Jest


If someone still run into this issue, you need to know that require.context is a webpack-specific feature, so it doesn't work in jest.

You can try to mock it, like someone already provided as an answer in this How can I mock Webpack's require.context in Jest? SO question. But you can't use it without any workaround.