-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 test helpers for testing PRs without having to release them #3547
Comments
Perhaps I am missing something but I am trying to envision a use case for this. From my experience, whenever we utilize the pr-release workflow it's often to use the subsequently released As for any potential regressions that such a change may introduce, why wouldn't our current test workflows suffice? I would imagine any changes someone wants to introduce would be accompanied by some kind of test (whether unit/integration). It may be useful to give an example of such an instance to provide more clarity here. |
@maschad you can see an example of the need for this in #3508. Essentially whenever we have issues related to package managers we'd have a need for these kinds of tests as we'd have control over the package manager and could emulate the actual problem. Also, if we have problems with Besides that, IMO generally having our |
I think we could close this in favor of: |
Sometimes in order to test a PR we release it by commenting out this line, after which we install the released package via e.g.
pnpm create fuels@pr-number
orpnpm add fuels@pr-number
and then do manual steps to verify the PR fixes the bug at hand. The problem with this is that it's a manual process and we don't have testing infrastructure in our SDK via which we can emulate these manual steps in a test and guarantee protection against regressions.A way to fully emulate these manual steps can be something like this:
/tmp/fuels/unique-id/
)pnpm init
in it (orbun init
,npm init
- depending on what we're testing for)pnpm link
to link the localfuels
package that's under test to the temporarypackage.json
, thereby simulating apnpm add fuels@pr-number
,fuels
package however you see fit, e.g. if it's problems with the cli, run the appropriate cli package after you've set the test folder's contents up to reproduce the bug.All the testing would be done via
spawn(commandUnderTest, { detached: true, cwd: tempDirRootPath })
which would guarantee that the process is not part of thevitest
test runner process. We'd have to make sure to clean those processes up as well after the test is finished because adetached
process isn't killed when its initiator process exits (vitest
in our case).An example implementing the above can be found here.
We already have some infrastructure around testing the cli like bootstrapProject so we can integrate that as well. Also, there might not be a need to run some commands like
pnpm link
orpnpm init
- maybe we can do some copy/pastes which would be faster. It's a thing to investigate.The text was updated successfully, but these errors were encountered: