Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions test/jest/compile.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { TestContext } = require("./helpers");

describe("compile", () => {
const ctx = new TestContext("./test/jest/compile");

afterAll(() => {
ctx.cleanUp();
});

describe("in an empty project", () => {
const ctxEmpty = new TestContext("./test/jest/empty");

it("should error on partial input", async () => {
await expect(ctxEmpty.runEask("compile")).rejects.toThrow();
});
});

describe("for compile/mock.el", () => {
it("should compile with a warning", async () => {
await ctx.runEask("compile mock.el");
});

it("should escalate warnings given --strict", async () => {
await expect(
ctx.runEask("compile --strict mock.el"),
).rejects.toMatchObject({ code: 1 });
});
});

describe("for compile/fail.el", () => {
beforeEach(async () => {
await ctx.runEask("clean elc");
});

it("should error", async () => {
await expect(ctx.runEask("compile fail.el")).rejects.toMatchObject({
code: 1,
});
});

it("should compile mock.el given --allow-error", async () => {
await expect(
ctx.runEask("compile --allow-error fail.el mock.el"),
).rejects.toMatchObject({
code: 1,
stderr: expect.stringContaining("1 file compiled, 1 skipped"),
});
expect(ctx.fileExists("./mock.elc"));
});
});
});
2 changes: 2 additions & 0 deletions test/jest/compile/Eask
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; -*- mode: eask; lexical-binding: t -*-
(package "check" "0.0.1" "mock package")
3 changes: 3 additions & 0 deletions test/jest/compile/fail.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
;; -*- lexical-binding: t -*-
;; this must fail to compile
(fail "" (
5 changes: 5 additions & 0 deletions test/jest/compile/mock.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
;;;###autoload
(defun my-ignore-fn ()
"Mock for testing"
(interactive)
(message "foo"))
Loading