以下代码段说明了我的问题:
// 1. This uses 'external-web-components'
import Dep1 from '@/components/Dep1'
// 2. This module is webpack bundled
const ExternalComponents = require('external-web-components')
Vue.use(ExternalComponents)
describe('Test dep1', function () {
it.only('It should do something', function () {
// 3. 'external-web-components' uses this. How to mock it?
// This doesnt work...
jest.mock('vue-directive-tooltip', () => ({}))
const wrapper = mount(Dep1)
})
})
有人知道如何解决这个问题吗?