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

"Cannot convert a Symbol value to a string" when using testdouble.js mocks #238

Closed
albhilazo opened this issue Dec 7, 2017 · 3 comments
Closed
Labels

Comments

@albhilazo
Copy link

Version

1.0.0-beta.6

Reproduction link

https://codepen.io/albhilazo/pen/EbBPNv

Steps to reproduce

Use testdouble.js mock objects with vue-test-utils version >= beta4.

Open the reproduction CodePen to see a minimal test and the Cannot convert a Symbol value to a string error.

What is expected?

That testdouble mock objects as ES6 proxies work when passed to mount or shallow.
They worked until beta3.

Reproduction with beta3: https://codepen.io/albhilazo/pen/aVgvvz

What is actually happening?

Tests break when using testdouble mock objects since beta4.

Reproduction with beta6: https://codepen.io/albhilazo/pen/EbBPNv


I use testdouble.js for mocking.

testdouble provides the creation of mock objects as ES6 proxies by calling td.object().

This is really convenient since, for example, it enables us to mount a component with a mocked router and set different mocked methods for each scenario later on.

We have been using this method with vue-test-utils but it started failing since beta4.

@eddyerburgh eddyerburgh added the bug label Dec 8, 2017
@eddyerburgh
Copy link
Member

We started defining properties as reactive in beta 6. The Proxy created by testdouble throws an error when we call it in defineReactive. This might well be a bug with Vue, I'll investigate it further.

Alternatively, we could try/catch the call to defineReactive, but that wouldn't be ideal.

@eddyerburgh
Copy link
Member

This is an issue with testdouble—testdouble/testdouble.js#300.

Sorry that it started throwing an error in beta.6. This is because we now call defineProperty with the mock, and that causes this error in testdouble.

I'm closing this issue, since this is something that needs to be fixed on their end.

@albhilazo
Copy link
Author

Oops, I was wrong to assume it was an issue with vue-test-utils due to it failing with newer versions.

Thank you for your time!

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

No branches or pull requests

2 participants