Skip to content

Commit 8cc5e62

Browse files
committed
address feedback
1 parent ba584ac commit 8cc5e62

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

scripts/emulator-testing/database-test-runner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import { spawn } from 'child-process-promise';
1818
import * as path from 'path';
1919

2020
import { DatabaseEmulator } from './emulators/database-emulator';
21+
import { ChildProcessPromise } from './emulators/emulator';
2122

22-
async function runTest(port: number, namespace: string): Promise<any> {
23+
function runTest(port: number, namespace: string): ChildProcessPromise {
2324
const options = {
2425
cwd: path.resolve(__dirname, '../../packages/database'),
2526
env: Object.assign({}, process.env, {

scripts/emulator-testing/emulators/database-emulator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class DatabaseEmulator extends Emulator {
2929
'https://storage.googleapis.com/firebase-preview-drop/emulator/firebase-database-emulator-v3.5.0.jar';
3030
}
3131

32-
async setPublicRules(): Promise<number> {
32+
setPublicRules(): Promise<number> {
3333
console.log('Setting rule {".read": true, ".write": true} to emulator ...');
3434
return new Promise<number>((resolve, reject) => {
3535
request.put(

scripts/emulator-testing/emulators/emulator.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import * as path from 'path';
2121
import * as request from 'request';
2222
import * as tmp from 'tmp';
2323

24+
export interface ChildProcessPromise extends Promise<void> {
25+
childProcess: ChildProcess;
26+
}
27+
2428
export abstract class Emulator {
2529
binaryName: string;
2630
binaryUrl: string;
@@ -33,7 +37,7 @@ export abstract class Emulator {
3337
this.port = port;
3438
}
3539

36-
async download(): Promise<void> {
40+
download(): Promise<void> {
3741
return new Promise<void>((resolve, reject) => {
3842
tmp.dir((err, dir) => {
3943
if (err) reject(err);
@@ -55,9 +59,9 @@ export abstract class Emulator {
5559
});
5660
}
5761

58-
async setUp(): Promise<void> {
62+
setUp(): Promise<void> {
5963
return new Promise<void>((resolve, reject) => {
60-
const promise: any = spawn(
64+
const promise: ChildProcessPromise = spawn(
6165
'java',
6266
['-jar', path.basename(this.binaryPath), '--port', this.port],
6367
{
@@ -96,7 +100,7 @@ export abstract class Emulator {
96100
});
97101
}
98102

99-
async tearDown(): Promise<void> {
103+
tearDown(): void {
100104
if (this.emulator) {
101105
console.log(`Shutting down emulator, pid: [${this.emulator.pid}] ...`);
102106
this.emulator.kill();

scripts/emulator-testing/firestore-test-runner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
import { spawn } from 'child-process-promise';
1818
import * as path from 'path';
1919

20+
import { ChildProcessPromise } from './emulators/emulator';
2021
import { FirestoreEmulator } from './emulators/firestore-emulator';
2122

22-
async function runTest(port: number, projectId: string): Promise<any> {
23+
function runTest(port: number, projectId: string): ChildProcessPromise {
2324
const options = {
2425
cwd: path.resolve(__dirname, '../../packages/firestore'),
2526
env: Object.assign({}, process.env, {

0 commit comments

Comments
 (0)