File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,37 @@ t.test('search <name> --json', (t) => {
130
130
src . end ( )
131
131
} )
132
132
133
+ t . test ( 'search <invalid-module> --json' , ( t ) => {
134
+ const src = new Minipass ( )
135
+ src . objectMode = true
136
+
137
+ npm . flatOptions . json = true
138
+ config . json = true
139
+ const libnpmsearch = {
140
+ stream ( ) {
141
+ return src
142
+ } ,
143
+ }
144
+
145
+ const Search = t . mock ( '../../lib/search.js' , {
146
+ ...mocks ,
147
+ libnpmsearch,
148
+ } )
149
+ const search = new Search ( npm )
150
+
151
+ search . exec ( [ 'foo' ] , ( err ) => {
152
+ if ( err )
153
+ throw err
154
+
155
+ t . equal ( result , '\n[]\n' , 'should have expected empty square brackets' )
156
+
157
+ config . json = false
158
+ t . end ( )
159
+ } )
160
+
161
+ src . end ( )
162
+ } )
163
+
133
164
t . test ( 'search <name> --searchexclude --searchopts' , t => {
134
165
npm . flatOptions . search = {
135
166
...flatOptions . search ,
You can’t perform that action at this time.
0 commit comments