@@ -57,15 +57,22 @@ describe('sign', () => {
5757 * Run the sign command with stubs for all dependencies.
5858 */
5959 function sign ( tmpDir , stubs , { extraArgs = { } , extraOptions = { } } = { } ) {
60+ const signCLIOptions = {
61+ verbose : false ,
62+ artifactsDir : path . join ( tmpDir . path ( ) , 'artifacts-dir' ) ,
63+ sourceDir : tmpDir . path ( ) ,
64+ channel : 'listed' ,
65+ ...stubs . signingConfig ,
66+ ...extraArgs ,
67+ } ;
68+ if (
69+ ! ( 'uploadSourceCode' in signCLIOptions ) &&
70+ ! ( 'onlyHumanReadableSourceCode' in signCLIOptions )
71+ ) {
72+ signCLIOptions . onlyHumanReadableSourceCode = true ;
73+ }
6074 return completeSignCommand (
61- {
62- verbose : false ,
63- artifactsDir : path . join ( tmpDir . path ( ) , 'artifacts-dir' ) ,
64- sourceDir : tmpDir . path ( ) ,
65- channel : 'listed' ,
66- ...stubs . signingConfig ,
67- ...extraArgs ,
68- } ,
75+ signCLIOptions ,
6976 {
7077 ...stubs . signingOptions ,
7178 ...extraOptions ,
@@ -89,6 +96,7 @@ describe('sign', () => {
8996 sourceDir,
9097 artifactsDir : path . join ( tmpDir . path ( ) , 'artifacts' ) ,
9198 channel : 'listed' ,
99+ onlyHumanReadableSourceCode : true ,
92100 ...stubs . signingConfig ,
93101 apiProxy,
94102 } ,
@@ -223,6 +231,21 @@ describe('sign', () => {
223231 } ) ;
224232 } ) ) ;
225233
234+ it ( 'rejects an UsageError if --upload-source-code or --only-human-readable-source-code are both falsey' , async ( ) => {
235+ const signPromise = completeSignCommand ( { } ) ;
236+ await assert . isRejected ( signPromise , UsageError ) ;
237+ await assert . isRejected ( signPromise , / I n c o m p l e t e c o m m a n d . E i t h e r .* C L I o p t i o n s s h o u l d b e e x p l i c i t l y i n c l u d e d / ) ;
238+ } ) ;
239+
240+ it ( 'rejects an UsageError if --upload-source-code and --only-human-readable-source-code are both truthy' , async ( ) => {
241+ const signPromise = completeSignCommand ( {
242+ uploadSourceCode : 'fake-source-code-path.zip' ,
243+ onlyHumanReadableSourceCode : true ,
244+ } ) ;
245+ await assert . isRejected ( signPromise , UsageError ) ;
246+ await assert . isRejected ( signPromise , / I n v a l i d o p t i o n s . O n l y o n e o f .* C L I o p t i o n s s h o u l d b e i n c l u d e d / ) ;
247+ } ) ;
248+
226249 it ( 'passes the uploadSourceCode parameter to submissionAPI signer as submissionSource' , ( ) =>
227250 withTempDir ( ( tmpDir ) => {
228251 const stubs = getStubs ( ) ;
0 commit comments