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

feat(tests): Add a test to validate scripts/migration/renamings.js #5980

Merged
merged 17 commits into from
Mar 9, 2022

Conversation

cpcallen
Copy link
Contributor

@cpcallen cpcallen commented Mar 4, 2022

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

Resolves #5645.

Proposed Changes

  • Make scripts/migration/renamings.js a valid JSON5 file.
  • Add a JSON schema for it in tests/migration/renamings-schema.json.
  • Add a script to test one against the other, as tests/migration/validate-renamings.
    • This is a node.js script that will exit 0 if the renamings file is valid, or 1 if it is not (and print a not-very-helpful error message from which is possible, with some effort, to deduce what the error is.)
  • Modify renamings.js so that:
    • It actually complies with the schema.
    • Adjust the version numbers so that they are the first version in which the change was released, rather than the last version in which it was not.
  • Modify tests/run_all_tests.sh to run validate-renamings.
  • Finish filling out pull request template.

Behaviour Before Change

The renamings file existed, but it had a different format and there were no tests.

Behaviour After Change

Now we have a beautifully formatted, schema-ed renamings file that should serve all of our renaming needs.

Reason for Changes

Supporting handling renamings for people.

Test Coverage

This is tests!

Documentation

N/A

Additional Information

N/A

* Make scripts/migration/renamings.js a valid JSON5 file.
* Add a schema for it in tests/migration/renamings-schema.json.
* Add a script to test one against the other, as
  tests/migration/validate-renamings.  It is a node.js script
  that will exit 0 if the renamings file is valid, or 1 if it
  is not (and print a not-very-helpful error message from which
  is possible, with some effort, to deduce what the error is.)
@cpcallen cpcallen linked an issue Mar 4, 2022 that may be closed by this pull request
Copy link
Contributor Author

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm dubious about the reordering; let's discuss.

scripts/migration/renamings.json5 Show resolved Hide resolved
scripts/migration/renamings.json5 Outdated Show resolved Hide resolved
scripts/migration/renamings.json5 Show resolved Hide resolved
scripts/migration/renamings.json5 Outdated Show resolved Hide resolved
@@ -11,8 +11,6 @@
* This file is in JSON5 format; see https://json5.org/.
*/

/* eslint-disable */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since eslint is more picky about formatting than JSON5.parse (sensibly!), I wonder if we should still try to lint this file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks useful but I think I want to postpone this to a later PR: there are some things I don't quite understand about our eslint setup.

tests/migration/validate-renamings.js Show resolved Hide resolved
tests/run_all_tests.sh Outdated Show resolved Hide resolved
cpcallen and others added 4 commits March 7, 2022 16:32
And fix the resulting validation error in the example entry.
Tweaked line wrapping of some existing entries (example and
acutal) that were otherwise untouched.
Also fixed extraneous whitespace in run_all_tests.sh
@cpcallen cpcallen marked this pull request as ready for review March 7, 2022 23:57
@cpcallen cpcallen requested a review from a team as a code owner March 7, 2022 23:57
# Conflicts:
#	scripts/migration/renamings.js
@cpcallen
Copy link
Contributor Author

cpcallen commented Mar 8, 2022

Tests failing on Node v12 with Error: Cannot find module 'fs/promises'. Should be an easy fix.

Also remove success message, to adhere to usual unix convention
(silence implies success) as eslint does, and reduce unecessary
npm test output clutter.
@cpcallen
Copy link
Contributor Author

cpcallen commented Mar 8, 2022

OK, @gonfunko: this should now be ready for final review.

tests/migration/validate-renamings.js Outdated Show resolved Hide resolved
scripts/migration/renamings.json5 Outdated Show resolved Hide resolved
scripts/migration/renamings.json5 Outdated Show resolved Hide resolved
* Fix typos.
* Remove redundant check.
@BeksOmega BeksOmega merged commit 3c723f0 into develop Mar 9, 2022
@cpcallen cpcallen deleted the validate-renamings branch August 18, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test for renamings.js
3 participants