@@ -20,48 +20,48 @@ const tempInstallResult = {
2020 addon : { id : 'some-addon@test-suite' } ,
2121} ;
2222
23+ function prepareRun ( fakeInstallResult ) {
24+ const sourceDir = fixturePath ( 'minimal-web-ext' ) ;
25+
26+ const argv = {
27+ artifactsDir : path . join ( sourceDir , 'web-ext-artifacts' ) ,
28+ sourceDir,
29+ noReload : true ,
30+ keepProfileChanges : false ,
31+ browserConsole : false ,
32+ } ;
33+ const options = {
34+ buildExtension : sinon . spy ( ( ) => { } ) ,
35+ firefoxApp : getFakeFirefox ( ) ,
36+ firefoxClient : sinon . spy ( ( ) => {
37+ return Promise . resolve ( getFakeRemoteFirefox ( {
38+ installTemporaryAddon : ( ) =>
39+ Promise . resolve (
40+ fakeInstallResult || tempInstallResult
41+ ) ,
42+ } ) ) ;
43+ } ) ,
44+ reloadStrategy : sinon . spy ( ( ) => {
45+ log . debug ( 'fake: reloadStrategy()' ) ;
46+ } ) ,
47+ MultiExtensionRunner : sinon . spy ( FakeExtensionRunner ) ,
48+ desktopNotifications : sinon . spy ( ( ) => { } ) ,
49+ } ;
50+
51+ return {
52+ argv,
53+ options,
54+ run : ( customArgv = { } , customOpt = { } ) => run (
55+ { ...argv , ...customArgv } ,
56+ { ...options , ...customOpt }
57+ ) ,
58+ } ;
59+ }
60+
2361describe ( 'run' , ( ) => {
2462 let androidRunnerStub : sinon . SinonStub ;
2563 let desktopRunnerStub : sinon . SinonStub ;
2664
27- function prepareRun ( fakeInstallResult ) {
28- const sourceDir = fixturePath ( 'minimal-web-ext' ) ;
29-
30- const argv = {
31- artifactsDir : path . join ( sourceDir , 'web-ext-artifacts' ) ,
32- sourceDir,
33- noReload : true ,
34- keepProfileChanges : false ,
35- browserConsole : false ,
36- } ;
37- const options = {
38- buildExtension : sinon . spy ( ( ) => { } ) ,
39- firefoxApp : getFakeFirefox ( ) ,
40- firefoxClient : sinon . spy ( ( ) => {
41- return Promise . resolve ( getFakeRemoteFirefox ( {
42- installTemporaryAddon : ( ) =>
43- Promise . resolve (
44- fakeInstallResult || tempInstallResult
45- ) ,
46- } ) ) ;
47- } ) ,
48- reloadStrategy : sinon . spy ( ( ) => {
49- log . debug ( 'fake: reloadStrategy()' ) ;
50- } ) ,
51- MultiExtensionRunner : sinon . spy ( FakeExtensionRunner ) ,
52- desktopNotifications : sinon . spy ( ( ) => { } ) ,
53- } ;
54-
55- return {
56- argv,
57- options,
58- run : ( customArgv = { } , customOpt = { } ) => run (
59- { ...argv , ...customArgv } ,
60- { ...options , ...customOpt }
61- ) ,
62- } ;
63- }
64-
6565 beforeEach ( ( ) => {
6666 androidRunnerStub = sinon . stub (
6767 // TODO: use async import instead of require - https://github.com/mozilla/web-ext/issues/1306
0 commit comments