Closed wolfmanstout closed 5 months ago
One thing that was surprising (to me) about the Mocha unit tests: I have to run "npm install" twice to reliably rebuild after grammar changes (you can bet I found out the hard way, after nearly tearing my hair out). This is because npm install rebuilds the bindings based on binding.gyp as its first step, before parser.c is regenerated (which is a dependency of the bindings). If someone who is more familiar with npm and/or tree-sitter knows if there's a better way, that would be helpful. Otherwise this might be worth documenting.
I fixed the aforementioned issue (following tree-sitter-python here).
Thanks!
Any reason for choosing Mocha?
I saw Cursorless uses it 😂
I'm new to Node.js so no strong preference. I see that the most recent version of Node.js released this year has a native lightweight framework we could also use. Not sure if tooling support is as good, and means people would need recent Node to run tests, though.
Let's not depend on the latest version.
For now, I'd suggest jest?
Paging @pokey: Why Mocha over Jest?
Should make a note that if we add a testing framework, we should port the current JS tests to it.
Yeah we'd prob be using jest if it weren't for mocha being default framework for VSCode tests
No problem, I can switch to Jest. Any reason for the preference? Just curious for my own education.
Updated to use Jest, ready for review.
Any questions? Feel free to ping me on Slack.
This is now merged. Sorry for the delay!
Fixes #36