-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
parse5.parseFragment is not a function => parsers/parse5.js|ts #1847
parse5.parseFragment is not a function => parsers/parse5.js|ts #1847
Comments
Hi @MathiasBoisgardDev, thanks for the report! Could you provide some details on which environment you are using? Module resolution as it is done within Node shouldn't have an issue here. |
Yeah sure: MacOS Big Sur : v11.3.1 Do you need more than those information ? |
Just wanted to note that I have the same exact issue with this library. I have to lock it down to rc5 to get around it. I'm on latest Windows, latest stable node.js. |
Same, everything works fine by locking on .5 |
Hello !
I found an issue after searching for a while where it came from.
I use enzyme in a project for my Unit Tests, and the library uses cheerio for its internal function 'render'
The problem
When I execute my tests, every call to 'render' method from enzyme has an error :
TypeError: parse5.parseFragment is not a function
This error only occurs for cheerio version >v1.0.0-rc.5 as the structure of your library changed between .5 and .6
Before the import of parse5 was made directly in lib/parse.js and then moved to parsers/parse5.js
The problem is that when you require('parse5') in parsers/parse5.js, you actually require the file itself, so
var parse5 = require('parse5');
is actually an object containing the function
parse
andrender
and not the functions from the library parse5 (parse
,parseFragment
andserialize
)The solution
I can do a Pull request to change the name of the file and so avoid this problem (tested locally and functionnal)
The text was updated successfully, but these errors were encountered: