From bc2d5ef36fa106b91a2580b0f25c43ae5204d80a Mon Sep 17 00:00:00 2001 From: William Durand Date: Mon, 9 Jan 2023 21:33:00 +0100 Subject: [PATCH] Ensure empty ZIP files will output results when auto-close feature is disabled (#4662) --- tests/fixtures/empty.zip | Bin 0 -> 22 bytes tests/unit/test.linter.js | 13 +++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/fixtures/empty.zip diff --git a/tests/fixtures/empty.zip b/tests/fixtures/empty.zip new file mode 100644 index 0000000000000000000000000000000000000000..15cb0ecb3e219d1701294bfdf0fe3f5cb5d208e7 GIT binary patch literal 22 NcmWIWW@Tf*000g10H*)| literal 0 HcmV?d00001 diff --git a/tests/unit/test.linter.js b/tests/unit/test.linter.js index f1c7a6ae..f428be54 100644 --- a/tests/unit/test.linter.js +++ b/tests/unit/test.linter.js @@ -1772,5 +1772,18 @@ describe('Linter.run()', () => { expect(FakeXpi.closeWasCalled).toEqual(true); }); + + it('should work with empty ZIP files', async () => { + const addonLinter = new Linter({ + _: ['tests/fixtures/empty.zip'], + disableXpiAutoclose: true, + }); + + await addonLinter.run(); + + const { errors } = addonLinter.collector; + expect(errors.length).toEqual(1); + expect(errors[0].code).toEqual(messages.TYPE_NO_MANIFEST_JSON.code); + }); }); });