Skip to content

When testing vue components, variables defined globally (app. config. globalProperties. $_=lodash)$_ How to test #2032

Open
@mlj18293180341

Description

@mlj18293180341

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions