-
-
Notifications
You must be signed in to change notification settings - Fork 54
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 smoke tests #52
Add smoke tests #52
Conversation
Run babel-upgrade against a couple of repositories. * babel-preset-env on a babel 6 branch for babel options in package.json. * screeps-flowtype-jest-skeleton for correct flow handling. * react-side-effect for mocha.opts handling.
I am not sure if we really need or want the full diff. Upgrade methods are handled by seperate tests and some not babel related lines are changed too.
With
|
const crossSpawn = require('cross-spawn'); | ||
const rimraf = require('rimraf'); | ||
|
||
async function gitCheckout(dir, repo, branch = 'master') { |
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.
should we check out a specific commit hash? will the snapshots need updating whenever the remote repo's branches are updated?
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.
In case of babel-preset-env we have a specific branch. For the two others I was not able to directly clone from a tag or commit, that is why I fall back to master for now. There is no other branch I could use. I am open to any suggestion making this more reliable.
But clone without --single-branch
is taking much longer, so I decided against a full clone and checkout of a tag or commit.
Maybe a specific repo just for this purpose with all cases would be better in the long run.
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.
ohhh i see -- you're saying that we can't clone a specific commit so easily because we would need to first clone the repo before being able to check out the commit, and that takes too long?
could we use the -n
flag on the initial clone to prevent the initial checkout, and then run git checkout <some-commit-hash>
?
that's my best idea for now at cloning a specific commit efficiently
otherwise, perhaps we could fork the test repos and clone the forks? 🤔
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.
Since this is an upgrade tool it doesn't make sense to have a test against master of a repo unless we cloned or just copy the contents as a fixture and then you wouldn't need to close it anyway?
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.
Just figured out that you can provide git clone --branch
with a tag too. Would this be sufficient?
We just would need a good flowtype repo with tags and/or branches to clone since the one I use right now does not provide any of those.
@hzoo You mean we copy the files that matter for babel-upgrade into a directory below fixtures
? We then would have to git reset --hard
that directory after we ran babel-upgrade because we do not want to accidentally commit those changes when running it locally. That could become a problem on itself since you Cannot do hard reset with paths.
as git phrases it.
Or we copy them from fixtures
into a temporary directory, run the tests there and delete it afterwards like I do right now.
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.
yeah, i think that would be sufficient -- with the caveat that it limits us to testing repos that are using tags, i suppose
agree with @hzoo that perhaps we don't need to bother with cloning at all. maybe this is a case where the proposed "dry run" mode could be justified? #6
alternatively, yes, i think copying them into a temp directory could work
Run babel-upgrade against a couple of repositories.
Fixes #22