Skip to content

Commit a333b74

Browse files
committed
Formatting
1 parent ddc28f0 commit a333b74

File tree

7 files changed

+99
-19
lines changed

7 files changed

+99
-19
lines changed

packages-exp/auth-exp/karma.conf.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ function getClientConfig(argv) {
5858
}
5959

6060
if (!process.env.GCLOUD_PROJECT || !process.env.FIREBASE_AUTH_EMULATOR_HOST) {
61-
console.error('Local testing against emulator requested, but ' +
62-
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
63-
'are missing');
61+
console.error(
62+
'Local testing against emulator requested, but ' +
63+
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
64+
'are missing'
65+
);
6466
process.exit(1);
6567
}
6668

@@ -70,7 +72,7 @@ function getClientConfig(argv) {
7072
projectId: process.env.GCLOUD_PROJECT,
7173
authDomain: 'local-auth-domain'
7274
},
73-
authEmulatorHost: process.env.FIREBASE_AUTH_EMULATOR_HOST,
75+
authEmulatorHost: process.env.FIREBASE_AUTH_EMULATOR_HOST
7476
};
7577
}
7678

packages-exp/auth-exp/scripts/run-node-tests.js

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
/**
33
* @license
44
* Copyright 2020 Google LLC
@@ -14,4 +14,71 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*/var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};exports.__esModule=true;var path_1=require("path");var child_process_promise_1=require("child-process-promise");var yargs=require("yargs");var argv=yargs.options({local:{type:"boolean"},integration:{type:"boolean"},webdriver:{type:"boolean"}}).argv;var nyc=path_1.resolve(__dirname,"../../../node_modules/.bin/nyc");var mocha=path_1.resolve(__dirname,"../../../node_modules/.bin/mocha");process.env.TS_NODE_COMPILER_OPTIONS='{"module":"commonjs"}';var testConfig=["src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts","--file","index.node.ts"];if(argv.integration){testConfig=["test/integration/flows/{email,anonymous}.test.ts"];if(argv.local){testConfig.push("test/integration/flows/*.local.test.ts")}}else if(argv.webdriver){testConfig=["test/integration/webdriver/**.test.ts"]}var args=__spreadArrays(["--reporter","lcovonly",mocha],testConfig,["--config","../../config/mocharc.node.js"]);if(argv.local){if(!process.env.GCLOUD_PROJECT||!process.env.FIREBASE_AUTH_EMULATOR_HOST){console.error("Local testing against emulator requested, but "+"GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables "+"are missing");process.exit(1)}}args=args.concat(argv._);var spawned=child_process_promise_1.spawn(nyc,args,{stdio:"inherit",cwd:process.cwd()});var childProcess=spawned.childProcess;spawned["catch"]((function(){childProcess.kill();process.exit(1)}));process.once("exit",(function(){return childProcess.kill()}));process.once("SIGINT",(function(){return childProcess.kill("SIGINT")}));process.once("SIGTERM",(function(){return childProcess.kill("SIGTERM")}));
17+
*/ var __spreadArrays =
18+
(this && this.__spreadArrays) ||
19+
function () {
20+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
21+
s += arguments[i].length;
22+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
23+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
24+
r[k] = a[j];
25+
return r;
26+
};
27+
exports.__esModule = true;
28+
var path_1 = require('path');
29+
var child_process_promise_1 = require('child-process-promise');
30+
var yargs = require('yargs');
31+
var argv = yargs.options({
32+
local: { type: 'boolean' },
33+
integration: { type: 'boolean' },
34+
webdriver: { type: 'boolean' }
35+
}).argv;
36+
var nyc = path_1.resolve(__dirname, '../../../node_modules/.bin/nyc');
37+
var mocha = path_1.resolve(__dirname, '../../../node_modules/.bin/mocha');
38+
process.env.TS_NODE_COMPILER_OPTIONS = '{"module":"commonjs"}';
39+
var testConfig = [
40+
'src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts',
41+
'--file',
42+
'index.node.ts'
43+
];
44+
if (argv.integration) {
45+
testConfig = ['test/integration/flows/{email,anonymous}.test.ts'];
46+
if (argv.local) {
47+
testConfig.push('test/integration/flows/*.local.test.ts');
48+
}
49+
} else if (argv.webdriver) {
50+
testConfig = ['test/integration/webdriver/**.test.ts'];
51+
}
52+
var args = __spreadArrays(['--reporter', 'lcovonly', mocha], testConfig, [
53+
'--config',
54+
'../../config/mocharc.node.js'
55+
]);
56+
if (argv.local) {
57+
if (!process.env.GCLOUD_PROJECT || !process.env.FIREBASE_AUTH_EMULATOR_HOST) {
58+
console.error(
59+
'Local testing against emulator requested, but ' +
60+
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
61+
'are missing'
62+
);
63+
process.exit(1);
64+
}
65+
}
66+
args = args.concat(argv._);
67+
var spawned = child_process_promise_1.spawn(nyc, args, {
68+
stdio: 'inherit',
69+
cwd: process.cwd()
70+
});
71+
var childProcess = spawned.childProcess;
72+
spawned['catch'](function () {
73+
childProcess.kill();
74+
process.exit(1);
75+
});
76+
process.once('exit', function () {
77+
return childProcess.kill();
78+
});
79+
process.once('SIGINT', function () {
80+
return childProcess.kill('SIGINT');
81+
});
82+
process.once('SIGTERM', function () {
83+
return childProcess.kill('SIGTERM');
84+
});

packages-exp/auth-exp/scripts/run-node-tests.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ let args = [
6464
// Make sure that the environment variables are present for local test
6565
if (argv.local) {
6666
if (!process.env.GCLOUD_PROJECT || !process.env.FIREBASE_AUTH_EMULATOR_HOST) {
67-
console.error('Local testing against emulator requested, but ' +
68-
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
69-
'are missing');
67+
console.error(
68+
'Local testing against emulator requested, but ' +
69+
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
70+
'are missing'
71+
);
7072
process.exit(1);
7173
}
7274
}

packages-exp/auth-exp/test/helpers/integration/emulator_rest_helpers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ interface OobCodesResponse {
5050
oobCodes: OobCodeSession[];
5151
}
5252

53-
export async function getPhoneVerificationCodes(
54-
): Promise<Record<string, VerificationSession>> {
53+
export async function getPhoneVerificationCodes(): Promise<
54+
Record<string, VerificationSession>
55+
> {
5556
const url = buildEmulatorUrlForPath('verificationCodes');
5657
const response: VerificationCodesResponse = await (
5758
await FetchProvider.fetch()(url)
@@ -73,7 +74,7 @@ export async function getOobCodes(): Promise<OobCodeSession[]> {
7374

7475
export async function resetEmulator(): Promise<void> {
7576
const url = buildEmulatorUrlForPath('accounts');
76-
await FetchProvider.fetch()(url, {method: 'DELETE'});
77+
await FetchProvider.fetch()(url, { method: 'DELETE' });
7778
}
7879

7980
function buildEmulatorUrlForPath(endpoint: string): string {

packages-exp/auth-exp/test/helpers/integration/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ export function getAppConfig(): FirebaseOptions {
5252

5353
export function getEmulatorUrl(): string | null {
5454
// Check karma first, then fallback on node process
55-
const host = getKarma()?.config?.authEmulatorHost || (USE_EMULATOR ? EMULATOR_HOST : null);
55+
const host =
56+
getKarma()?.config?.authEmulatorHost ||
57+
(USE_EMULATOR ? EMULATOR_HOST : null);
5658
return host ? `http://${host}` : null;
5759
}
5860

packages-exp/auth-exp/test/integration/webdriver/static/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ window.startAuth = async () => {
4949
auth = getAuth(app);
5050
useAuthEmulator(auth, emulatorUrl);
5151
window.auth = auth;
52-
}
52+
};

packages-exp/auth-exp/test/integration/webdriver/util/authdriver.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
import { Auth, User } from '@firebase/auth-exp';
2020
import { Builder, WebDriver } from 'selenium-webdriver';
2121
import { resetEmulator } from '../../../helpers/integration/emulator_rest_helpers';
22-
import { getEmulatorUrl, PROJECT_ID, USE_EMULATOR } from '../../../helpers/integration/settings';
22+
import {
23+
getEmulatorUrl,
24+
PROJECT_ID,
25+
USE_EMULATOR
26+
} from '../../../helpers/integration/settings';
2327
import { authTestServer } from './test_server';
2428

2529
/** Browsers to run the tests on */
@@ -32,7 +36,7 @@ export enum TestFunction {
3236
AWAIT_AUTH_INIT = 'authInit',
3337
USER_SNAPSHOT = 'userSnap',
3438
AUTH_SNAPSHOT = 'authSnap',
35-
START_AUTH = 'startAuth',
39+
START_AUTH = 'startAuth'
3640
}
3741

3842
/** Helper wraper around the WebDriver object */
@@ -112,9 +116,11 @@ export class AuthDriver {
112116

113117
private async injectConfigAndInitAuth(): Promise<void> {
114118
if (!USE_EMULATOR) {
115-
throw new Error('Local testing against emulator requested, but ' +
116-
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
117-
'are missing');
119+
throw new Error(
120+
'Local testing against emulator requested, but ' +
121+
'GCLOUD_PROJECT and FIREBASE_AUTH_EMULATOR_HOST env variables ' +
122+
'are missing'
123+
);
118124
}
119125

120126
await this.webDriver.executeScript(`

0 commit comments

Comments
 (0)