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

Improve test harness diagnostics #17

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

takikawa
Copy link
Contributor

@takikawa takikawa commented Oct 10, 2024

This PR improves debugging with the spec tests. For invalid source maps it prints the failure reason so it's much easier to check if maps are rejected for the right reason.

For known failures, use todo to make it easier to track why it's failing.

Also update the spec test submod.

Note: in most cases, invalid maps are being rejected for the right reason thankfully. But in some cases the test cases need tweaking to avoid the wrong exception (there's a fairly trivial issue related to source handling) and there are a few cases where the upstream source-map library is not error-checking where it should. I'll make separate PRs related to these.

  * Print diagnostic message for invalid source map tests with
    the error messages in the exception to make it easier to
    tell if maps are invalid for the right reason
  * Use `todo` instead of `skip` to print out the failure messages
    for known failures so that they can be fixed later
@takikawa
Copy link
Contributor Author

takikawa commented Oct 10, 2024

To illustrate this PR a bit better, here's a sample of how it shows invalid SM tests:

  ✔ The source map spec test case "validMappingEmptyGroups" has a valid source map (0.882309ms)                                                                           
  ✔ The source map spec test case "validMappingEmptyString" has a valid source map (0.980224ms)                                                                           
  ✔ The source map spec test case "indexMapWrongTypeSections" has an invalid source map (0.765349ms)                                                                      
  ℹ Source map "sections" field is not an object.                                                                                                                         
  ✔ The source map spec test case "indexMapWrongTypeOffset" has an invalid source map (0.896847ms)                                                                        
  ℹ Source file not found: empty-original.js undefined                                                                                                                    
  ✔ The source map spec test case "indexMapWrongTypeMap" has an invalid source map (0.818119ms)                                                           
  ℹ Index map section 0 is missing a "map" field or it is invalid.   

Before this PR the ℹ lines weren't present so you couldn't tell why it was rejected. In the second to last case, the exception is actually spurious which I'll fix later.

@jkup
Copy link
Owner

jkup commented Oct 30, 2024

This is great, thanks!

@jkup jkup merged commit 183339f into jkup:main Oct 30, 2024
2 checks passed
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.

2 participants