This repository was archived by the owner on Sep 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,12 @@ module.exports = class Gemini extends PassthroughEmitter {
103103 }
104104
105105 _exec ( fn ) {
106- const plugins = pluginsLoader . load ( this , this . config . system . plugins , PREFIX ) ;
107- return bluebirdQ ( Promise . all ( plugins ) . then ( ( ) => fn ( ) ) ) ;
106+ return bluebirdQ ( this . _loadPlugins ( ) . then ( ( ) => fn ( ) ) ) ;
107+ }
108+
109+ _loadPlugins ( ) {
110+ this . _loadPlugins = ( ) => Promise . resolve ( ) ; // load plugins only once
111+ return Promise . all ( pluginsLoader . load ( this , this . config . system . plugins , PREFIX ) ) ;
108112 }
109113
110114 _readTests ( paths , options ) {
Original file line number Diff line number Diff line change @@ -183,6 +183,14 @@ describe('gemini', () => {
183183 return assert . isRejected ( result , err )
184184 . then ( ( ) => assert . notCalled ( Runner . prototype . run ) ) ;
185185 } ) ;
186+
187+ it ( 'should load plugins only once' , ( ) => {
188+ const gemini = initGemini ( ) ;
189+
190+ return gemini . readTests ( )
191+ . then ( ( collection ) => gemini . test ( collection ) )
192+ . then ( ( ) => assert . calledOnce ( pluginsLoader . load ) ) ;
193+ } ) ;
186194 } ) ;
187195
188196 describe ( 'readTests' , ( ) => {
You can’t perform that action at this time.
0 commit comments