fix(unzip): migrate the dependency used to extract zip archives from unzipper to adm-zip#9
Merged
andreynering merged 5 commits intogo-task:masterfrom Jun 17, 2023
Conversation
…er` package Previous tests have mocked up the `Extract` function of the `unzipper` package. This test does not confirm that the same functionality is maintained by updating the `src/assets/unzip.js` file. It also does not test whether the previous code and the new code extracted the ZIP file correctly. So I rewrote the test code. By mocking the file system and the HTTP request, we can now do the same test no matter which unzip library we use. Added dependencies: + mock-fs + nock The rewritten test code was tested with the old `src/assets/unzip.js` before the update. If necessary, check out this commit using the `git checkout` command and test the old `src/assets/unzip.js` with the updated test code.
…`unzipper` to `adm-zip` There is a bug in "unzipper" that does not extract files in a ZIP archive properly. So instead of "unzipper", use "adm-zip".
Collaborator
Author
|
Merged
The test code before my changes used Jest mock functions. However, I rewrote it into very unreadable test code using the `Promise` constructor. This is because initially I could not think of a way to write an asynchronous test that waited until the mock function was called. But now I have found a way. So I will modify the test code to make the differences smaller.
Collaborator
Author
|
I have modified the test code. it('should call onSuccess on unzip close', async () => {
const req = await getReq(
'https://example.com/releases/latest.zip',
TEST_ZIP.data,
);
await expect(new Promise((onSuccess, onError) => {
unzip({ opts: { binPath: './bin', binName: 'command' }, req, onSuccess, onError });
})).resolves.not.toThrow();
});I modified these hard-to-read codes as follows: it('should call onSuccess on unzip close', async () => {
const req = await getReq(
'https://example.com/releases/latest.zip',
TEST_ZIP.data,
);
const { onSuccess, onError, waitFinish } = createCallbacks();
unzip({ opts: { binPath: './bin', binName: 'command' }, req, onSuccess, onError });
await waitFinish;
expect(onSuccess).toHaveBeenCalled();
});This will reduce the differences from the original test code before the change, and should make it easier to see what changes have been made. |
sounisi5011
added a commit
to sounisi5011/package-version-git-tag
that referenced
this pull request
Jul 2, 2023
The `@go-task/go-npm` included in `@go-task/cli` now installs the `task` command in the correct location on Windows! see go-task/go-npm#5, go-task/go-npm#8, and go-task/go-npm#9 This reverts commit abb45e1
sounisi5011
added a commit
to sounisi5011/package-version-git-tag
that referenced
this pull request
Jul 2, 2023
* ⬆️ Update dependency @go-task/cli to v3.27.1 ( 77618ab ) * 🔥 Remove patches for `@go-task/go-npm` package ( d626085 ) The `@go-task/go-npm` included in `@go-task/cli` now installs the `task` command in the correct location on Windows! see go-task/go-npm#5, go-task/go-npm#8, and go-task/go-npm#9 This reverts commit abb45e1 * ⬆️ Update `pnpm-lock.yaml` ( 36c5f37 ) * 📝 Update CHANGELOG ( 766d804 ) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sonishi Izuka <sounisi5011@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a bug in
unzipperthat does not extract files in a ZIP archive properly.ZJONSSON/node-unzipper#271
So instead of
unzipper, useadm-zip.Closes #7