File tree Expand file tree Collapse file tree 3 files changed +41
-20
lines changed Expand file tree Collapse file tree 3 files changed +41
-20
lines changed Original file line number Diff line number Diff line change 2222 "@types/chai" : " ^4.1.2" ,
2323 "@types/mocha" : " ^5.0.0" ,
2424 "chai" : " ^4.1.2" ,
25- "firebase-functions" : " https://storage.googleapis.com/functions-dev-preview/firebase-functions-1.0.0-rc4 .tgz" ,
25+ "firebase-functions" : " https://storage.googleapis.com/functions-dev-preview/firebase-functions-1.0.0-rc5 .tgz" ,
2626 "mocha" : " ^5.0.5" ,
2727 "sinon" : " ^4.4.9" ,
2828 "tslint" : " ^5.8.0" ,
Original file line number Diff line number Diff line change 1+ import { makeChange , wrap , mockConfig } from './main' ;
2+ import * as analytics from './providers/analytics' ;
3+ import * as crashlytics from './providers/crashlytics' ;
4+ import * as database from './providers/database' ;
5+ import * as firestore from './providers/firestore' ;
6+ import * as pubsub from './providers/pubsub' ;
7+ import * as storage from './providers/storage' ;
8+
9+ export interface FeaturesList {
10+ mockConfig : typeof mockConfig ;
11+ wrap : typeof wrap ;
12+ makeChange : typeof makeChange ;
13+ analytics : typeof analytics ;
14+ crashlytics : typeof crashlytics ;
15+ database : typeof database ;
16+ firestore : typeof firestore ;
17+ pubsub : typeof pubsub ;
18+ storage : typeof storage ;
19+ }
20+
21+ export const features : FeaturesList = {
22+ mockConfig,
23+ wrap,
24+ makeChange,
25+ analytics,
26+ crashlytics,
27+ database,
28+ firestore,
29+ pubsub,
30+ storage,
31+ } ;
Original file line number Diff line number Diff line change 2121// SOFTWARE.
2222
2323import { AppOptions } from 'firebase-admin' ;
24+ import { merge } from 'lodash' ;
2425
2526import { FirebaseFunctionsTest } from './lifecycle' ;
26- import { makeChange , wrap , mockConfig } from './main' ;
27- import * as analytics from './providers/analytics' ;
28- import * as crashlytics from './providers/crashlytics' ;
29- import * as database from './providers/database' ;
30- import * as firestore from './providers/firestore' ;
31- import * as pubsub from './providers/pubsub' ;
32- import * as storage from './providers/storage' ;
27+ import { features as lazyFeatures , FeaturesList } from './features' ;
3328
3429export = ( firebaseConfig ?: AppOptions ) => {
3530 const test = new FirebaseFunctionsTest ( ) ;
3631 test . init ( firebaseConfig ) ;
37- return {
38- cleanup : test . cleanup ,
39- mockConfig,
40- wrap,
41- makeChange,
42- analytics,
43- crashlytics,
44- database,
45- firestore,
46- pubsub,
47- storage,
48- } ;
32+ // Ensure other files get loaded after init function, since they load `firebase-functions`
33+ // which will issue warning if process.env.FIREBASE_CONFIG is not yet set.
34+ let features = require ( './features' ) as typeof lazyFeatures ;
35+ features = merge ( { } , features , {
36+ cleanup : ( ) => test . cleanup ,
37+ } ) ;
38+ return features ;
4939} ;
You can’t perform that action at this time.
0 commit comments