Skip to content

Commit e384c72

Browse files
authoredJun 4, 2023
test: increase timeout for npm cli wrapper tests (#107)
1 parent 69b2f85 commit e384c72

File tree

1 file changed

+70
-52
lines changed

1 file changed

+70
-52
lines changed
 

‎src/npm/__tests__/call-npm-cli.test.ts

+70-52
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,82 @@ import { describe, it } from "vitest";
33
import * as errors from "../../errors.js";
44
import * as subject from "../call-npm-cli.js";
55

6+
const TIMEOUT = 10_000;
7+
68
describe.concurrent("callNpmCli", () => {
7-
it("should call npm CLI", async ({ expect }) => {
8-
const result = await subject.callNpmCli("config", ["list"], {
9-
ignoreScripts: true,
10-
environment: {
11-
npm_config_scope: "@cool-scope",
12-
},
13-
});
9+
it(
10+
"should call npm CLI",
11+
async ({ expect }) => {
12+
const result = await subject.callNpmCli("config", ["list"], {
13+
ignoreScripts: true,
14+
environment: {
15+
npm_config_scope: "@cool-scope",
16+
},
17+
});
1418

15-
expect(result).toEqual({
16-
successData: expect.objectContaining({
17-
json: true,
18-
"ignore-scripts": true,
19-
scope: "@cool-scope",
20-
}),
21-
errorCode: undefined,
22-
error: undefined,
23-
});
24-
});
19+
expect(result).toEqual({
20+
successData: expect.objectContaining({
21+
json: true,
22+
"ignore-scripts": true,
23+
scope: "@cool-scope",
24+
}),
25+
errorCode: undefined,
26+
error: undefined,
27+
});
28+
},
29+
TIMEOUT
30+
);
2531

26-
it("should call npm CLI without ignoring scripts", async ({ expect }) => {
27-
const result = await subject.callNpmCli("config", ["list"], {
28-
ignoreScripts: false,
29-
environment: {
30-
npm_config_scope: "@cool-scope",
31-
},
32-
});
32+
it(
33+
"should call npm CLI without ignoring scripts",
34+
async ({ expect }) => {
35+
const result = await subject.callNpmCli("config", ["list"], {
36+
ignoreScripts: false,
37+
environment: {
38+
npm_config_scope: "@cool-scope",
39+
},
40+
});
3341

34-
expect(result).toMatchObject({
35-
successData: expect.objectContaining({ "ignore-scripts": false }),
36-
});
37-
});
42+
expect(result).toMatchObject({
43+
successData: expect.objectContaining({ "ignore-scripts": false }),
44+
});
45+
},
46+
TIMEOUT
47+
);
3848

39-
it("should return undefined if no JSON in output", async ({ expect }) => {
40-
const result = await subject.callNpmCli("config", ["get", "scope"], {
41-
ignoreScripts: true,
42-
environment: {
43-
npm_config_scope: "",
44-
},
45-
});
49+
it(
50+
"should return undefined if no JSON in output",
51+
async ({ expect }) => {
52+
const result = await subject.callNpmCli("config", ["get", "scope"], {
53+
ignoreScripts: true,
54+
environment: {
55+
npm_config_scope: "",
56+
},
57+
});
4658

47-
expect(result).toEqual({
48-
successData: undefined,
49-
errorCode: undefined,
50-
error: undefined,
51-
});
52-
});
59+
expect(result).toEqual({
60+
successData: undefined,
61+
errorCode: undefined,
62+
error: undefined,
63+
});
64+
},
65+
TIMEOUT
66+
);
5367

54-
it("should return error details if error", async ({ expect }) => {
55-
const result = await subject.callNpmCli("config", [], {
56-
ignoreScripts: true,
57-
environment: {},
58-
});
68+
it(
69+
"should return error details if error",
70+
async ({ expect }) => {
71+
const result = await subject.callNpmCli("config", [], {
72+
ignoreScripts: true,
73+
environment: {},
74+
});
5975

60-
expect(result).toEqual({
61-
successData: undefined,
62-
errorCode: "EUSAGE",
63-
error: expect.any(errors.NpmCallError),
64-
});
65-
});
76+
expect(result).toEqual({
77+
successData: undefined,
78+
errorCode: "EUSAGE",
79+
error: expect.any(errors.NpmCallError),
80+
});
81+
},
82+
TIMEOUT
83+
);
6684
});

0 commit comments

Comments
 (0)
Failed to load comments.