File tree 3 files changed +12
-10
lines changed
packages/auth/src/core/auth
3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @firebase/auth " : patch
3
+ ---
4
+
5
+ Calls to ` connectAuthEmulator ` with the ` disableWarnings ` flag set to true will no longer cause a ` console.info ` warning to be printed
Original file line number Diff line number Diff line change @@ -130,16 +130,12 @@ describe('core/auth/emulator', () => {
130
130
) ;
131
131
} ) ;
132
132
133
- it ( 'logs out the warning but has no banner if disableBanner true ' , ( ) => {
133
+ it ( 'skips console info and has no banner if warnings disabled ' , ( ) => {
134
134
sinon . stub ( console , 'info' ) ;
135
135
connectAuthEmulator ( auth , 'http://localhost:2020' , {
136
136
disableWarnings : true
137
137
} ) ;
138
- expect ( console . info ) . to . have . been . calledWith (
139
- 'WARNING: You are using the Auth Emulator,' +
140
- ' which is intended for local testing only. Do not use with' +
141
- ' production credentials.'
142
- ) ;
138
+ expect ( console . info ) . not . to . have . been . called ;
143
139
if ( typeof document !== 'undefined' ) {
144
140
expect ( document . querySelector ( '.firebase-emulator-warning' ) ) . to . be . null ;
145
141
}
Original file line number Diff line number Diff line change @@ -75,7 +75,9 @@ export function connectAuthEmulator(
75
75
options : Object . freeze ( { disableWarnings } )
76
76
} ) ;
77
77
78
- emitEmulatorWarning ( disableWarnings ) ;
78
+ if ( ! disableWarnings ) {
79
+ emitEmulatorWarning ( ) ;
80
+ }
79
81
}
80
82
81
83
function extractProtocol ( url : string ) : string {
@@ -114,7 +116,7 @@ function parsePort(portStr: string): number | null {
114
116
return port ;
115
117
}
116
118
117
- function emitEmulatorWarning ( disableBanner : boolean ) : void {
119
+ function emitEmulatorWarning ( ) : void {
118
120
function attachBanner ( ) : void {
119
121
const el = document . createElement ( 'p' ) ;
120
122
const sty = el . style ;
@@ -143,8 +145,7 @@ function emitEmulatorWarning(disableBanner: boolean): void {
143
145
}
144
146
if (
145
147
typeof window !== 'undefined' &&
146
- typeof document !== 'undefined' &&
147
- ! disableBanner
148
+ typeof document !== 'undefined'
148
149
) {
149
150
if ( document . readyState === 'loading' ) {
150
151
window . addEventListener ( 'DOMContentLoaded' , attachBanner ) ;
You can’t perform that action at this time.
0 commit comments