-
Notifications
You must be signed in to change notification settings - Fork 945
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
Add an 'updateResult' utility function to upsert values into data-*
files
#1809
base: gh-pages
Are you sure you want to change the base?
Add an 'updateResult' utility function to upsert values into data-*
files
#1809
Conversation
Most runtimes we support are browsers, so the primary workflow is to manually update results as they’re checked. Command-line runtimes sometimes have a script that updates the files automatically. |
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.
How is this intended to be used, exactly?
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Thanks for looking at this so quickly. I work with the Hermes engine team so we have an interest in (semi-)automating updates to I've pushed my changes to |
I’d say so. Happy to update those too if the approach looks good to you. |
…results to data files.
(Done) |
Thanks for the review @ljharb - the reason for the retro syntax though is the jshint lint setup for this project. For example, applying one of the suggestions above (which I'd normally very much agree with!):
I'm not exactly sure what that implies about runtime feature support, but I've tried to be as conservative as I remember how to be (my ES3 is a little rusty!), mostly for consistency's sake - hence avoiding These constraints make sense in the test code where we obviously need to cater for the lowest common denominator, but probably shouldn't apply to scripts written for Node JS, like this one or the various engine harnesses. I'm not sure how best to reconcile that - different lint settings for test code vs scripts? Different linter? Exclude scripts from lint? |
ha, ok fair enough :-) just ignore those suggestions for now; we should update from jshint to eslint anyways, and then we can use overrides so that scripts like this don't have to meet the same standards. |
Sounds good to me - I'll assume modern runtime support and apply all the suggestions the linter is happy with |
Not sure why this PR went nowhere, but #1881 achieves the same, without having to use a parser to modify the module code AND will allow custom Compat Tables, like the (vary outdated) custom compat Table we have at https://rhino.github.io/compat/engines.html |
As far as I could tell, the current accepted practice to update
data-
files is to use a script to suggest the changes to a console and then to make manual updates.This is a lot of work for new runtimes, and doesn't lend well to automating as part of a runtime release process.
This is a simple utility to parse and update
res
objects in place. It may be called from the test runner scripts - I used it to generate #1808.Because it uses an actual parser it should be robust to syntax gotchas like code-in-strings, but it makes a few basic assumptions that hold for the data files as they are now, like:
exports.tests = [ /* ... */ ]
sectionres
property, or an array-literalsubtests
property.