Skip to content

Commit 45822ce

Browse files
committed
Formatting, license
1 parent 969949e commit 45822ce

File tree

5 files changed

+134
-20
lines changed

5 files changed

+134
-20
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = function (config) {
2626
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
2727
frameworks: ['mocha'],
2828

29-
client: Object.assign({}, karmaBase.client, getClientConfig(argv)),
29+
client: Object.assign({}, karmaBase.client, getClientConfig(argv))
3030
});
3131

3232
config.set(karmaConfig);
@@ -59,9 +59,9 @@ function getClientConfig(argv) {
5959
authAppConfig: {
6060
apiKey: 'local-api-key',
6161
projectId: 'test-emulator',
62-
authDomain: 'local-auth-domain',
62+
authDomain: 'local-auth-domain'
6363
},
64-
authEmulatorPort: '9099',
64+
authEmulatorPort: '9099'
6565
};
6666
}
6767

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,69 @@
1-
"use strict";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"}}).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"]}var args=__spreadArrays(["--reporter","lcovonly",mocha],testConfig,["--config","../../config/mocharc.node.js"]);if(argv.local){process.env.AUTH_EMULATOR_PORT="9099";process.env.AUTH_EMULATOR_PROJECT_ID="test-emulator"}args=args.concat(argv._);var childProcess=child_process_promise_1.spawn(nyc,args,{stdio:"inherit",cwd:process.cwd()}).childProcess;process.once("exit",(function(){return childProcess.kill()}));process.once("SIGINT",(function(){return childProcess.kill("SIGINT")}));process.once("SIGTERM",(function(){return childProcess.kill("SIGTERM")}));
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
'use strict';
19+
var __spreadArrays =
20+
(this && this.__spreadArrays) ||
21+
function () {
22+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
23+
s += arguments[i].length;
24+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
25+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
26+
r[k] = a[j];
27+
return r;
28+
};
29+
exports.__esModule = true;
30+
var path_1 = require('path');
31+
var child_process_promise_1 = require('child-process-promise');
32+
var yargs = require('yargs');
33+
var argv = yargs.options({
34+
local: { type: 'boolean' },
35+
integration: { type: 'boolean' }
36+
}).argv;
37+
var nyc = path_1.resolve(__dirname, '../../../node_modules/.bin/nyc');
38+
var mocha = path_1.resolve(__dirname, '../../../node_modules/.bin/mocha');
39+
process.env.TS_NODE_COMPILER_OPTIONS = '{"module":"commonjs"}';
40+
var testConfig = [
41+
'src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts',
42+
'--file',
43+
'index.node.ts'
44+
];
45+
if (argv.integration) {
46+
testConfig = ['test/integration/flows/{email,anonymous}.test.ts'];
47+
}
48+
var args = __spreadArrays(['--reporter', 'lcovonly', mocha], testConfig, [
49+
'--config',
50+
'../../config/mocharc.node.js'
51+
]);
52+
if (argv.local) {
53+
process.env.AUTH_EMULATOR_PORT = '9099';
54+
process.env.AUTH_EMULATOR_PROJECT_ID = 'test-emulator';
55+
}
56+
args = args.concat(argv._);
57+
var childProcess = child_process_promise_1.spawn(nyc, args, {
58+
stdio: 'inherit',
59+
cwd: process.cwd()
60+
}).childProcess;
61+
process.once('exit', function () {
62+
return childProcess.kill();
63+
});
64+
process.once('SIGINT', function () {
65+
return childProcess.kill('SIGINT');
66+
});
67+
process.once('SIGTERM', function () {
68+
return childProcess.kill('SIGTERM');
69+
});

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
import { resolve } from 'path';
219

320
import { spawn } from 'child-process-promise';
@@ -17,7 +34,11 @@ const mocha = resolve(__dirname, '../../../node_modules/.bin/mocha');
1734

1835
process.env.TS_NODE_COMPILER_OPTIONS = '{"module":"commonjs"}';
1936

20-
let testConfig = ['src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts', '--file', 'index.node.ts'];
37+
let testConfig = [
38+
'src/!(platform_browser|platform_react_native|platform_cordova)/**/*.test.ts',
39+
'--file',
40+
'index.node.ts'
41+
];
2142

2243
if (argv.integration) {
2344
testConfig = ['test/integration/flows/{email,anonymous}.test.ts'];
@@ -46,4 +67,4 @@ const childProcess = spawn(nyc, args, {
4667

4768
process.once('exit', () => childProcess.kill());
4869
process.once('SIGINT', () => childProcess.kill('SIGINT'));
49-
process.once('SIGTERM', () => childProcess.kill('SIGTERM'));
70+
process.once('SIGTERM', () => childProcess.kill('SIGTERM'));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function getTestInstance(): Auth {
3939
const emulatorUrl = getEmulatorUrl();
4040

4141
if (emulatorUrl) {
42-
useAuthEmulator(auth, emulatorUrl, {disableWarnings: true});
42+
useAuthEmulator(auth, emulatorUrl, { disableWarnings: true });
4343
}
4444

4545
auth.onAuthStateChanged(user => {
Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
import { FirebaseOptions } from '@firebase/app-exp';
219

320
// __karma__ is an untyped global
@@ -12,29 +29,37 @@ const EMULATOR_PROJECT_ID = process.env.AUTH_EMULATOR_PROJECT_ID;
1229

1330
export const USE_EMULATOR = !!EMULATOR_PORT;
1431

15-
export const PROJECT_ID = USE_EMULATOR ? EMULATOR_PROJECT_ID : PROJECT_CONFIG.projectId;
16-
export const AUTH_DOMAIN = USE_EMULATOR ? 'emulator-auth-domain' : PROJECT_CONFIG.authDomain;
17-
export const API_KEY = USE_EMULATOR ? 'emulator-api-key' : PROJECT_CONFIG.apiKey;
18-
19-
32+
export const PROJECT_ID = USE_EMULATOR
33+
? EMULATOR_PROJECT_ID
34+
: PROJECT_CONFIG.projectId;
35+
export const AUTH_DOMAIN = USE_EMULATOR
36+
? 'emulator-auth-domain'
37+
: PROJECT_CONFIG.authDomain;
38+
export const API_KEY = USE_EMULATOR
39+
? 'emulator-api-key'
40+
: PROJECT_CONFIG.apiKey;
2041

2142
export function getAppConfig(): FirebaseOptions {
2243
// Prefer the karma config, then fallback on node process.env stuff
23-
return getKarma()?.config?.authAppConfig || {
24-
apiKey: API_KEY,
25-
projectId: PROJECT_ID,
26-
authDomain: AUTH_DOMAIN
27-
};
28-
};
44+
return (
45+
getKarma()?.config?.authAppConfig || {
46+
apiKey: API_KEY,
47+
projectId: PROJECT_ID,
48+
authDomain: AUTH_DOMAIN
49+
}
50+
);
51+
}
2952

3053
export function getEmulatorUrl(): string | null {
3154
// Check karma first, then fallback on node process
32-
const emulatorPort: string | null = getKarma()?.config?.authEmulatorPort || (USE_EMULATOR ? EMULATOR_PORT : null);
55+
const emulatorPort: string | null =
56+
getKarma()?.config?.authEmulatorPort ||
57+
(USE_EMULATOR ? EMULATOR_PORT : null);
3358

3459
return emulatorPort ? `http://localhost:${emulatorPort}` : null;
3560
}
3661

3762
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3863
function getKarma(): any {
3964
return typeof __karma__ !== 'undefined' ? __karma__ : undefined;
40-
}
65+
}

0 commit comments

Comments
 (0)