Skip to content

Commit cfdc51f

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

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
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
@@ -11,8 +11,11 @@ describe("install and uninstall", () => {
1111

1212
afterAll(() => ctx.cleanUp());
1313

14+
// See https://github.com/emacs-eask/cli/issues/11.
15+
const avoidPack11 = ((await emacsVersion()) < "28.1");
16+
1417
it("installs project package", async () => {
15-
await ctx.runEask("package"); // creates dist/<pkg>.tar
18+
await ctx.runEask("package", avoidPack11); // 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", avoidPack11);
4043
const { stderr } = await ctx.runEask("list");
4144
expect(stderr).not.toMatch(packageName);
4245
});

0 commit comments

Comments
 (0)