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

fix: filter out Symbol.hasInstance #1757

Closed

Conversation

nieyuyao
Copy link
Contributor

fix #1671

@nieyuyao nieyuyao force-pushed the fix/remove-symbol-hasInstance branch from 97b486e to 469232c Compare July 31, 2022 14:59
Copy link

@QGerrit QGerrit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unfortunately doesn't seem to quite be enough to fix #1671.... at least fully. After manually applying this patch locally, my tests started failing with TypeError: Cannot read properties of undefined (reading 'dataEmitted'). jsdom test environment in a very basic vue3 app.... oddly, dataEmitted doesn't seem to appear anywhere in my node_modules tree.

@nieyuyao nieyuyao marked this pull request as draft August 2, 2022 03:06
@nieyuyao
Copy link
Contributor Author

nieyuyao commented Aug 2, 2022

This unfortunately doesn't seem to quite be enough to fix #1671.... at least fully. After manually applying this patch locally, my tests started failing with TypeError: Cannot read properties of undefined (reading 'dataEmitted'). jsdom test environment in a very basic vue3 app.... oddly, dataEmitted doesn't seem to appear anywhere in my node_modules tree.

emmm.... I tried to find the reason and converted the PR into draft

@nieyuyao
Copy link
Contributor Author

nieyuyao commented Aug 2, 2022

This TypeError: Cannot read properties of undefined (reading 'dataEmitted') comes from here. Try to read the readableDidRead property and assign to the container when mocking. However, the Readable has not been initialized yet, so an error is thrown.

@QGerrit
Copy link

QGerrit commented Aug 2, 2022

Wow, good find! I forgot to mention I was doing vi.mock('axios'), that break location makes more sense now.

Copy link
Contributor

@simon-abbott simon-abbott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this solution. There are valid cases where we do want to mock Symbol.hasInstance, and, as you've noticed, this doesn't actually fix the root cause.

I'm working on a fix for the underlying issue which should be up shortly.

@simon-abbott
Copy link
Contributor

I've solved #1671 in a more general way over in #1786.

@nieyuyao nieyuyao closed this Aug 6, 2022
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

Successfully merging this pull request may close these issues.

[0.18.1] TypeError: Symbol.hasInstance is read-only
3 participants