Subject of the issue
When testing vue components, variables defined globally (app. config. globalProperties. $=lodash)$ How to test
Steps to reproduce
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import lodash form 'lodash'
const app = createApp(App)
app. config. globalProperties. $_=lodash
// component.vue
{{name}}
<script>
import { defineProps, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance()
const props = defineProps({
msg: String
})
let name = proxy.$_.isEmpty(props.msg)
</script>
// component.spec.js
error proxy.$_.isEmpty defined
Expected behaviour
What should happen?
Actual behaviour
What happens instead?
Possible Solution
What are the alternative solutions? Please describe what else you have considered?