Skip to content

Commit 65e972c

Browse files
committed
Formatting
1 parent b6ff847 commit 65e972c

File tree

3 files changed

+95
-7
lines changed

3 files changed

+95
-7
lines changed

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","--delay"]}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', '--delay'];
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/test/integration/webdriver/static/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ window.reset = () => {
4040
del.addEventListener('error', () => resolve());
4141
del.addEventListener('blocked', () => resolve());
4242
});
43-
}
43+
};
4444

4545
window.authInit = () => {
4646
return new Promise(resolve => {

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

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
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 { AuthDriver } from './auth_driver';
219

320
/*
421
* The most expensive operation in these tests is setting up / tearing down the
522
* driver. In order to avoid that cost, all of the tests are collected and
623
* bundled into single suites for each browser. To do this, we create a new
724
* describe function that is used to generate the new suites.
8-
*
25+
*
926
* This test is started with the --delay flag, which allows us to control when
1027
* test execution starts. Collection of the tests is synchronous, but we need
1128
* a way to ensure that run() is called after they're all added. To accomplish
@@ -26,9 +43,13 @@ const DRIVER = new AuthDriver();
2643
const SUITES: TempSuite[] = [];
2744

2845
/** Main entry point for all WebDriver tests */
29-
export function browserDescribe(title: string, generator:(driver: AuthDriver) => void): void {
46+
export function browserDescribe(
47+
title: string,
48+
generator: (driver: AuthDriver) => void
49+
): void {
3050
SUITES.push({
31-
title, generator
51+
title,
52+
generator
3253
});
3354
}
3455

@@ -57,7 +78,7 @@ setTimeout(() => {
5778
await DRIVER.reset();
5879
});
5980

60-
for (const {title, generator} of SUITES) {
81+
for (const { title, generator } of SUITES) {
6182
describe(title, () => generator(DRIVER));
6283
}
6384
});

0 commit comments

Comments
 (0)