You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cases where the empty object is already set as default in the config:
See: `stubs`, `mocks` and `methods`
https://github.com/vuejs/vue-test-utils/blob/dev/packages/test-utils/src/config.js
The ? is not necessary. In this case, we can import the config and we will not be forced to check the existence of attributes:
```
import { config } from '@vue/test-utils';
if (config.mocks) {
config.mocks.i18n = { t: jest.fn() };
config.mocks.$t = jest.fn();
}
```
and use directly
```
import { config } from '@vue/test-utils';
config.mocks.i18n = { t: jest.fn() };
config.mocks.$t = jest.fn();
```
0 commit comments