|
| 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 | +}); |
0 commit comments