|
| 1 | +const { TestContext } = require("./helpers"); |
| 2 | + |
| 3 | +describe("compile", () => { |
| 4 | + const ctx = new TestContext("./test/jest/compile"); |
| 5 | + |
| 6 | + afterAll(() => { |
| 7 | + ctx.cleanUp(); |
| 8 | + }); |
| 9 | + |
| 10 | + describe("in an empty project", () => { |
| 11 | + const ctxEmpty = new TestContext("./test/jest/empty"); |
| 12 | + |
| 13 | + it("should error on partial input", async () => { |
| 14 | + await expect(ctxEmpty.runEask("compile")).rejects.toThrow(); |
| 15 | + }); |
| 16 | + }); |
| 17 | + |
| 18 | + describe("for compile/mock.el", () => { |
| 19 | + it("should compile with a warning", async () => { |
| 20 | + await ctx.runEask("compile mock.el"); |
| 21 | + }); |
| 22 | + |
| 23 | + it("should escalate warnings given --strict", async () => { |
| 24 | + await expect( |
| 25 | + ctx.runEask("compile --strict mock.el"), |
| 26 | + ).rejects.toMatchObject({ code: 1 }); |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
| 30 | + describe("for compile/fail.el", () => { |
| 31 | + beforeEach(async () => { |
| 32 | + await ctx.runEask("clean elc"); |
| 33 | + }); |
| 34 | + |
| 35 | + it("should error", async () => { |
| 36 | + await expect(ctx.runEask("compile fail.el")).rejects.toMatchObject({ |
| 37 | + code: 1, |
| 38 | + }); |
| 39 | + }); |
| 40 | + |
| 41 | + it("should compile mock.el given --allow-error", async () => { |
| 42 | + await expect( |
| 43 | + ctx.runEask("compile --allow-error fail.el mock.el"), |
| 44 | + ).rejects.toMatchObject({ |
| 45 | + code: 1, |
| 46 | + stderr: expect.stringContaining("1 file compiled, 1 skipped"), |
| 47 | + }); |
| 48 | + expect(ctx.fileExists("./mock.elc")); |
| 49 | + }); |
| 50 | + }); |
| 51 | +}); |
0 commit comments