@@ -73,12 +73,12 @@ export interface MockShCommandController {
7373 /**
7474 * Adds a new command-specific mock result.
7575 *
76- * @param mock The mock result.
77- * @param [mock.exitCode] The mock process exit code.
78- * @param [mock.stdout] The mock stdout output.
79- * @param [mock.stderr] The mock stderr output.
76+ * @param [ mock] The mock result.
77+ * @param [mock.exitCode] The mock process exit code. Default: 0
78+ * @param [mock.stdout] The mock stdout output. Default: none
79+ * @param [mock.stderr] The mock stderr output. Default: none
8080 */
81- returns ( mock : { exitCode ?: number , stdout ?: string , stderr ?: string } ) : MockShCommandController ;
81+ returns ( mock ? : { exitCode ?: number , stdout ?: string , stderr ?: string } ) : MockShCommandController ;
8282
8383 /**
8484 * Ends this chain and starts a new command matcher.
@@ -92,12 +92,12 @@ export interface MockShController {
9292 /**
9393 * Adds a new default mock result.
9494 *
95- * @param mock The mock result.
96- * @param [mock.exitCode] The mock process exit code.
97- * @param [mock.stdout] The mock stdout output.
98- * @param [mock.stderr] The mock stderr output.
95+ * @param [ mock] The mock result.
96+ * @param [mock.exitCode] The mock process exit code. Default: 0
97+ * @param [mock.stdout] The mock stdout output. Default: none
98+ * @param [mock.stderr] The mock stderr output. Default: none
9999 */
100- returns ( mock : { exitCode ?: number , stdout ?: string , stderr ?: string } ) : MockShController ;
100+ returns ( mock ? : { exitCode ?: number , stdout ?: string , stderr ?: string } ) : MockShController ;
101101
102102 /**
103103 * Adds a command matcher.
@@ -181,12 +181,12 @@ sh.mock = () => {
181181 } ;
182182
183183 const mockController : MockShController = {
184- returns ( mock : { exitCode ?: number , stdout ?: string , stderr ?: string } ) {
184+ returns ( mock ? : { exitCode ?: number , stdout ?: string , stderr ?: string } ) {
185185 const {
186186 exitCode = 0 ,
187187 stdout = '' ,
188188 stderr = '' ,
189- } = mock ;
189+ } = mock ?? { } ;
190190 defaults . push ( { exitCode, stdout, stderr } ) ;
191191 return mockController ;
192192 } ,
@@ -199,12 +199,12 @@ sh.mock = () => {
199199 matchers . push ( [ re , mocks ] ) ;
200200
201201 const cmdController : MockShCommandController = {
202- returns ( mock : { exitCode ?: number , stdout ?: string , stderr ?: string } ) {
202+ returns ( mock ? : { exitCode ?: number , stdout ?: string , stderr ?: string } ) {
203203 const {
204204 exitCode = 0 ,
205205 stdout = '' ,
206206 stderr = '' ,
207- } = mock ;
207+ } = mock ?? { } ;
208208 mocks . push ( { exitCode, stdout, stderr } ) ;
209209 return cmdController ;
210210 } ,
0 commit comments