-
Notifications
You must be signed in to change notification settings - Fork 4
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(unzip): migrate the dependency used to extract zip archives from unzipper
to adm-zip
#9
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".
|
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.
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. |
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 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>
There is a bug in
unzipper
that does not extract files in a ZIP archive properly.ZJONSSON/node-unzipper#271
So instead of
unzipper
, useadm-zip
.Closes #7