Skip to content

Commit d97337f

Browse files
committed
Fixed failing tests
1 parent 445c490 commit d97337f

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

packages/auth/src/core/auth/emulator.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ import { Auth } from '../../model/public_types';
1818
import { AuthErrorCode } from '../errors';
1919
import { _assert } from '../util/assert';
2020
import { _castAuth } from './auth_impl';
21-
import { deepEqual, isCloudWorkstation, pingServer, updateStatus } from '@firebase/util';
21+
import {
22+
deepEqual,
23+
isCloudWorkstation,
24+
pingServer,
25+
updateStatus
26+
} from '@firebase/util';
2227

2328
/**
2429
* Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
@@ -98,13 +103,7 @@ export function connectAuthEmulator(
98103
authInternal.settings.appVerificationDisabledForTesting = true;
99104

100105
if (!disableWarnings) {
101-
updateStatus(
102-
{
103-
name: 'Auth',
104-
isRunningEmulator: true
105-
},
106-
isCloudWorkstation(emulatorConfig.host)
107-
);
106+
emitEmulatorWarning(isCloudWorkstation(emulatorConfig.host));
108107
}
109108

110109
// Workaround to get cookies in Firebase Studio
@@ -148,3 +147,20 @@ function parsePort(portStr: string): number | null {
148147
}
149148
return port;
150149
}
150+
151+
function emitEmulatorWarning(isCloudWorkstation: boolean): void {
152+
updateStatus(
153+
{
154+
name: 'Auth',
155+
isRunningEmulator: true
156+
},
157+
isCloudWorkstation
158+
);
159+
if (typeof console !== 'undefined' && typeof console.info === 'function') {
160+
console.info(
161+
'WARNING: You are using the Auth Emulator,' +
162+
' which is intended for local testing only. Do not use with' +
163+
' production credentials.'
164+
);
165+
}
166+
}

packages/auth/src/core/util/fetch_provider.ts

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class FetchProvider {
3737
}
3838

3939
static fetch(): typeof fetch {
40-
console.log('fetch!');
4140
if (this.fetchImpl) {
4241
return this.fetchImpl;
4342
}

packages/storage/src/platform/node/connection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ abstract class FetchConnection<T extends ConnectionType>
5151
method: string,
5252
isUsingEmulator: boolean,
5353
body?: NodeJS.ArrayBufferView | Blob | string,
54-
headers?: Record<string, string>,
54+
headers?: Record<string, string>
5555
): Promise<void> {
5656
if (this.sent_) {
5757
throw internalError('cannot .send() more than once');

packages/util/src/emulator.ts

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export function updateStatus(
173173
parentDiv.style.borderRadius = '10px';
174174
parentDiv.style.padding = '.5em';
175175
parentDiv.style.textAlign = 'center';
176+
parentDiv.classList.add('firebase-emulator-warning');
176177
document.body.appendChild(parentDiv);
177178
}
178179

0 commit comments

Comments
 (0)