@@ -3,64 +3,82 @@ import { describe, it } from "vitest";
3
3
import * as errors from "../../errors.js" ;
4
4
import * as subject from "../call-npm-cli.js" ;
5
5
6
+ const TIMEOUT = 10_000 ;
7
+
6
8
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
+ } ) ;
14
18
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
+ ) ;
25
31
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
+ } ) ;
33
41
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
+ ) ;
38
48
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
+ } ) ;
46
58
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
+ ) ;
53
67
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
+ } ) ;
59
75
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
+ ) ;
66
84
} ) ;
0 commit comments