@@ -20,21 +20,26 @@ import {
20
20
beforeEach ,
21
21
describe ,
22
22
expect ,
23
- it
23
+ it , jest
24
24
} from '@jest/globals'
25
25
import {
26
26
bootstrapTestVariables ,
27
27
getDefaultArgv ,
28
28
TEST_CLUSTER
29
29
} from '../../test_util.js'
30
30
import {
31
- constants
31
+ constants ,
32
+ logging
32
33
} from '../../../src/core/index.mjs'
33
34
import { flags } from '../../../src/commands/index.mjs'
34
35
import { sleep } from '../../../src/core/helpers.mjs'
35
36
import * as version from '../../../version.mjs'
36
37
37
38
describe ( 'ClusterCommand' , ( ) => {
39
+ // mock showUser and showJSON to silent logging during tests
40
+ jest . spyOn ( logging . Logger . prototype , 'showUser' ) . mockImplementation ( )
41
+ jest . spyOn ( logging . Logger . prototype , 'showJSON' ) . mockImplementation ( )
42
+
38
43
const testName = 'cluster-cmd-e2e'
39
44
const namespace = testName
40
45
const argv = getDefaultArgv ( )
@@ -75,7 +80,6 @@ describe('ClusterCommand', () => {
75
80
try {
76
81
await expect ( clusterCmd . reset ( argv ) ) . resolves . toBeTruthy ( )
77
82
} catch ( e ) {
78
- clusterCmd . logger . showUserError ( e )
79
83
expect ( e ) . toBeNull ( )
80
84
}
81
85
}
@@ -89,7 +93,6 @@ describe('ClusterCommand', () => {
89
93
try {
90
94
await expect ( clusterCmd . setup ( argv ) ) . rejects . toThrowError ( 'Error on cluster setup' )
91
95
} catch ( e ) {
92
- clusterCmd . logger . showUserError ( e )
93
96
expect ( e ) . toBeNull ( )
94
97
}
95
98
} , 60000 )
@@ -102,7 +105,6 @@ describe('ClusterCommand', () => {
102
105
try {
103
106
await expect ( clusterCmd . setup ( argv ) ) . resolves . toBeTruthy ( )
104
107
} catch ( e ) {
105
- clusterCmd . logger . showUserError ( e )
106
108
expect ( e ) . toBeNull ( )
107
109
}
108
110
} , 60000 )
@@ -111,7 +113,6 @@ describe('ClusterCommand', () => {
111
113
try {
112
114
await expect ( clusterCmd . getClusterInfo ( ) ) . resolves . toBeTruthy ( )
113
115
} catch ( e ) {
114
- clusterCmd . logger . showUserError ( e )
115
116
expect ( e ) . toBeNull ( )
116
117
}
117
118
} , 60000 )
@@ -120,7 +121,6 @@ describe('ClusterCommand', () => {
120
121
try {
121
122
await expect ( clusterCmd . showClusterList ( ) ) . resolves . toBeTruthy ( )
122
123
} catch ( e ) {
123
- clusterCmd . logger . showUserError ( e )
124
124
expect ( e ) . toBeNull ( )
125
125
}
126
126
} , 60000 )
@@ -129,7 +129,6 @@ describe('ClusterCommand', () => {
129
129
try {
130
130
await expect ( clusterCmd . showInstalledChartList ( ) ) . resolves . toBeUndefined ( )
131
131
} catch ( e ) {
132
- clusterCmd . logger . showUserError ( e )
133
132
expect ( e ) . toBeNull ( )
134
133
}
135
134
} , 60000 )
@@ -156,7 +155,6 @@ describe('ClusterCommand', () => {
156
155
try {
157
156
await expect ( clusterCmd . reset ( argv ) ) . resolves . toBeTruthy ( )
158
157
} catch ( e ) {
159
- clusterCmd . logger . showUserError ( e )
160
158
expect ( e ) . toBeNull ( )
161
159
}
162
160
} , 60000 )
0 commit comments