Skip to content

Commit d0df212

Browse files
committed
test: Avoid reporting error on incompat versions
1 parent 9d33b9d commit d0df212

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

test/jest/helpers.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ class TestContext {
157157
* @param {any} config
158158
* @returns {Promise.<CommandOutput>}
159159
*/
160-
runEask(command, config) {
161-
return this.run(this.easkCommand + " " + command, config);
160+
runEask(command, config, safe = false) {
161+
return this.run(this.easkCommand + " " + command, config, safe);
162162
}
163163

164164
/**
@@ -170,7 +170,7 @@ class TestContext {
170170
* @param {any} config
171171
* @returns {Promise.<CommandOutput>}
172172
*/
173-
run(command, config) {
173+
run(command, config, safe = false) {
174174
return exec(command, {
175175
cwd: this.cwd,
176176
signal: this.controller.signal,
@@ -188,7 +188,12 @@ class TestContext {
188188
return new CommandOutput(obj, this.cwd);
189189
})
190190
.catch((err) => {
191-
if (!err.code) err.message += "\nexec: TIMEOUT";
191+
if (safe)
192+
return this.errorToCommandOutput(err);
193+
194+
if (!err.code)
195+
err.message += "\nexec: TIMEOUT";
196+
192197
throw err;
193198
});
194199
}

test/jest/install.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ describe("install and uninstall", () => {
55
const ctx = new TestContext("./test/jest/install/");
66
const packageName = "mini.pkg.1";
77

8+
// See https://github.com/emacs-eask/cli/issues/11.
9+
const avoid11 = (emacsVersion() < "28.1");
10+
811
beforeAll(async () => {
912
await ctx.runEask("clean all");
1013
});
1114

1215
afterAll(() => ctx.cleanUp());
1316

1417
it("installs project package", async () => {
15-
await ctx.runEask("package"); // creates dist/<pkg>.tar
18+
await ctx.runEask("package", avoid11); // creates dist/<pkg>.tar
1619
await ctx.runEask("install"); // installs dependencies and generated package
1720
const { stderr } = await ctx.runEask("list");
1821
expect(stderr).toMatch(packageName);
@@ -36,7 +39,7 @@ describe("install and uninstall", () => {
3639
});
3740

3841
it("uninstalls project package", async () => {
39-
await ctx.runEask("uninstall");
42+
await ctx.runEask("uninstall", avoid11);
4043
const { stderr } = await ctx.runEask("list");
4144
expect(stderr).not.toMatch(packageName);
4245
});

test/jest/local.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ describe("local", () => {
1010
const cwd = "./test/jest/local";
1111
const ctx = new TestContext(cwd);
1212

13+
// See https://github.com/emacs-eask/cli/issues/11.
14+
const avoid11 = (emacsVersion() < "28.1");
15+
1316
// NOTE: install-deps takes a long time in this package
1417
// this is because of recipe dependencies triggering
1518
// "temporary archives" build.
16-
beforeAll(async () => await ctx.runEask("install-deps", { timeout: 40000 }));
19+
beforeAll(async () => await ctx.runEask("install-deps", { timeout: 40000 }, avoid11));
1720

1821
afterAll(() => ctx.cleanUp());
1922

0 commit comments

Comments
 (0)