-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
test: improve snapshot testing for js engine #866
Conversation
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Yeah, that's interesting; it's weird that it seems that in the first pass, the results are exactly the same, but somehow, the second pass has different args. I do not yet have a clue why this would happen |
if (!(i === 2 && name === 'beancount')) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment this out to run the full suite.
With the help of your latest changes, I found the problem. 😖 Turns out Oniguruma's In other words, This change will be made in the next version of I'd recommend landing all of these changes (after removing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #866 +/- ##
==========================================
+ Coverage 95.18% 95.21% +0.02%
==========================================
Files 83 83
Lines 7057 7057
Branches 1461 1460 -1
==========================================
+ Hits 6717 6719 +2
+ Misses 332 330 -2
Partials 8 8 ☔ View full report in Codecov by Sentry. |
Heads up that the next version of It turns out that Aside: There are also open issues here, here, and here that, if resolved, would further improve the JS engine's numbers. |
There are still some mismatches in the JS engine I can't explain.
Beancount is a good grammar to investigate because it has a relatively small number of patterns and doesn't use any pattern features with expected potential for mismatches, like unsupported uses of
\G
.Following are the current grammars labeled as mismatched (no parsing errors that move them to unsupported) when
oniguruma-to-es
optionallowUnhandledGAnchors
is set tofalse
:I think if we identify what's wrong with beancount we might fix all of these, plus bring down the "diff" count on some other grammars that are currently unsupported.
However, if just looking directly at the JS engine's whole results for the beancount grammar via
compare.test.js
, although it's hard for me to interpret, it looks like there might not be any pattern match differences, but rather maybe the JS engine itself is working slightly differently than the Oniguruma engine. So it might be something that requires adjusting/fixing in the JS engine code rather than inoniguruma-to-es
.@antfu asked me to send a draft PR to help investigate.
Note: I've removed the file system alias for
oniguruma-to-es
since I'm not sure it’s not doing anything to help. You can just changepackages/engine-javascript/package.json
to use"oniguruma-to-es": "file:../../../oniguruma-to-es"
, during development/testing.