lmiller1990 / vue-testing-handbook

A guide on testing Vue components and applications
https://lmiller1990.github.io/vue-testing-handbook/
876 stars 160 forks source link

jest.init.js does not load before test runs by default #195

Closed sethPoulin closed 2 years ago

sethPoulin commented 2 years ago

In the chapter mocking-global-objects.md, it's suggested to add the mock for the i18n library to the jest.init.js file, since this file "is loaded before the tests are run automatically." But this needs to be expressly configured by adding the following to the jest.config.js file:

export default {
    setupFiles: ["<rootDir>/jest.init.js"]
}

I'd suggest you add this to the documentation or suggest that users of the testing guide copy the jest.config.js file from the repo.

Thanks for putting this guide together!

lmiller1990 commented 2 years ago

Good idea, I'd like to add this. Thanks for pointing this out! Would you like to make a PR?

sethPoulin commented 2 years ago

Sure, I'd be happy to.