Skip to content

@vue/cli-plugin-unit-mocha env var causes errors with vue-loader #2270

Open
@eddyerburgh

Description

@eddyerburgh

Version

3.0.1

Reproduction link

https://github.com/girder/girder_web_components/blob/vue-test-utils-bug/tests/unit/HelloWorld.spec.js

Steps to reproduce

yarn install && yarn test:unit

What is expected?

Component should not error when mounted

What is actually happening?

Error is thrown (TypeError: Cannot read property 'parent' of undefined)


The issue is when a component has a prop of parent, component is built with vue-loader when target equals node, and the component is mounted.

When the normalizeComponent function runs, it accesses this.parent. This throws an error, because the component _props has not yet been added, although the parent getter already has been added in initProps.

Removing target: node fixes this. What was the reason for including it in the config?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions