Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional template can't be mounted #360

Closed
ghost opened this issue Jan 19, 2018 · 3 comments
Closed

Functional template can't be mounted #360

ghost opened this issue Jan 19, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 19, 2018

Version

1.0.0-beta.10

Reproduction link

https://github.com/noamcore/functional-template

Steps to reproduce

git clone https://github.com/noamcore/functional-template.git
cd functional-template
npm install
npm run unit

What is expected?

The component can be tested using <template functional/>.

What is actually happening?

Error saying that mount.context can only be used when mounting a functional component


Functional component using functional attribute on template is on Vue 2.5.0 .

@LinusBorg
Copy link
Member

LinusBorg commented Jan 19, 2018

Does that only happen when the functional component is a completely empty one like yours?

@LinusBorg
Copy link
Member

Hm, I think this rather is a problem with vue-jest. vue-test-utils never gets to see the <template> element as that's converted when impotrting the component into the test file. So vue-jest has to make sure that functional: true is set on that component's options. However it seems that vue-jest does something different, namely kind of converting a functional component into a "normal" one....

https://github.com/eddyerburgh/vue-jest/blob/master/lib/process.js#L30-L38

/cc @eddyerburgh

@eddyerburgh
Copy link
Member

Thanks for the bug report 🙂

Could you please open this issue in vue-jest? As @LinusBorg says, this needs to be fixed there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants