Skip to content

createLocalVue retains plugins added in previous tests #937

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

Closed
danielelkington opened this issue Aug 21, 2018 · 1 comment
Closed

createLocalVue retains plugins added in previous tests #937

danielelkington opened this issue Aug 21, 2018 · 1 comment

Comments

@danielelkington
Copy link

Version

1.0.0-beta.24

Reproduction link

https://codesandbox.io/s/rmr67jmolo

Steps to reproduce

On opening the reproduction link, go straight to the "Tests" tab.

What is expected?

There should be 2 failed tests: "01 should fail" and "03 should fail" - they are exactly the same.
Plugins added to a local vue instance created using createLocalVue should only be applied to that vue instance.

What is actually happening?

Only "01 should fail" fails. The test that runs in the middle unexpectedly causes the third to succeed. Furthermore, in codesandbox you'll notice that by re-running the tests they will all start succeeding.
Hence, plugins added to a local vue instance created using createLocalVue get applied to all future vue instances created using createLocalVue.


See tests/unit/test.spec.js.

This can also be reproduced in tests across multiple files - depending on the order the test files are run in, one can get different results if an earlier file registers a plugin on a local vue instance (created using createLocalVue). Therefore, createLocalVue doesn't seem to be returning fresh vue instances without any plugins. This is a problem because it means that if we have lots of tests across many files and wish to register plugins in some tests and not others, we cannot do it, and the order that tests run in becomes important (it shouldn't be).

Ideally each time you call createLocalVue you should receive a fresh vue instance without any plugins installed.

@eddyerburgh
Copy link
Member

Currently when we auto stub components we add a name to the original unnamed components, in order to ensure we can identify them in find when you use the component constructor. This is a workaround that we should fix, as you said, tests should be reproducible. I'll look into an alternative for future versions.

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

No branches or pull requests

2 participants