-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix(4.x): migrate from optimist to yargs #1666
Conversation
I recommend looking at yargs unit tests and maybe mimicking what is done there to test handlebars cli options. @fabb, happy to help on this, can I get permissions to your fork? |
Seems like the unit testing structure in place will make this some what difficult. Will try to leverage the current unit testing structure to get this done. |
@aorinevo I invited you to this repo, feel free to commit to this branch, thanks for offering! I‘ll probably only get to continue on this in 2 days. I‘ll then have a look at what you‘ve done in the mean time, and at the yargs tests as you suggested. I guess for coordination it should be enough when we write here in this PR when we start and stop making changes, what do you think? |
I think that makes sense. I'll update with comments accordingly. |
Tracking testing progress on my end via:
|
@fabb, please give me a heads up before merging any changes from your end on this branch. I'd like to squash my commits into one; it's easier if there are no interwoven commits from other contributors. |
d86addc
to
1e1831f
Compare
@fabb, unfortunately I squashed your commits down with mine. If you have those commits locally, I can add them back. Just push them to a branch called |
closes handlebars-lang#1658 adapted code from master to latest yargs (`.option` calls). ``` 4.x: found 188 vulnerabilities (169 low, 4 moderate, 14 high, 1 critical) in 5815 scanned packages 4.x with this PR: found 32 vulnerabilities (17 low, 1 moderate, 13 high, 1 critical) in 5829 scanned packages ```
some indirect dependencies install @types packages which are not compatible with the older typescript. adjusted test's tsconfig to not pick these up automatically, as the actual .d.ts does not depend on these external types.
d8c33f0
to
e4ae377
Compare
Added back @AviVahl's commits. |
Going to pause here for a bit. Added unit tests for 8 options. Might pick this up again later. |
I'm not here for fame, so it's fine with me ;-) |
spec/expected/version.txt
Outdated
@@ -0,0 +1 @@ | |||
4.7.3 |
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.
maybe we can read out the dynamic value from package.json to make updating less annoying
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.
That would really be preferable! It's possible to do e.g. require('path/to/package.json').version
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.
Might require reworking the task runner but definitely doable and a better approach.
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.
another approach might be just verifying that the output is /\d+\.\d+\.\d+/
but I wouldn't worry about missing a test for this one command if it's too fiddly.
Main thing is that having this fail after every release would be a major maintenance burden 😅
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.
Like most things, this ended up being pretty straight forward 🥳.
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.
This file can be removed now.
Thanks @ErisDS, I’ll try to get this wrapped up tonight :) |
@fabb, picking this backup now. Let me know if you have any WIP. |
@ErisDS, I'd like to recommend skipping a unit test for Thoughts? |
a7ff52c
to
5e6a255
Compare
@ErisDS, assuming we skip |
(Disclaimer: This is just something I tried in the volunteer spirit, while we wait for a proper review. I am not fluent with JS projects, so take this with a grain of salt/feel free to ignore if it is not helpful. Apologies in advance if that is the case.) Should these tests pass with the old (My Travis runs can be viewed here: https://travis-ci.com/github/DeeDeeG/handlebars.js/branches) |
@DeeDeeG, I'm rather curious myself why that's the case. I'm going to take a look. |
@DeeDeeG, still looking for the root cause but worth noting that all the tests pass with the exception of the unit test for |
Follow-up on #1662, added a few unit test on top of the original PR.
closes #1658
closes #1661
Note that there are not yet tests for all command line options. I know too little about handlebars yet (it's just a sub-sub-dependency of a package I use). If someone has good suggestions on what makes sense to test, fire away, I will update the PR.
Since I use
npm audit
to fail my build to not get vulnerable packages get released to production, I'm very interested into getting this merged.Tested: