Skip to content

Commit cf6ce4e

Browse files
committed
cleanup
1 parent 7153bb7 commit cf6ce4e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/test-all.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
name: Test All Packages
1616

17-
on: push
17+
on: pull_request
1818

1919
env:
2020
# make chromedriver detect installed Chrome version and download the corresponding driver
@@ -92,8 +92,7 @@ jobs:
9292
- name: Run unit tests
9393
# Ignore auth and firestore since they're handled in their own separate jobs.
9494
run: |
95-
# xvfb-run yarn lerna run --ignore '{firebase-messaging-integration-test,@firebase/auth*,@firebase/firestore*,firebase-firestore-integration-test}' test:ci
96-
xvfb-run yarn lerna run --scope @firebase/data-connect test
95+
xvfb-run yarn lerna run --ignore '{firebase-messaging-integration-test,@firebase/auth*,@firebase/firestore*,firebase-firestore-integration-test}' test:ci
9796
node scripts/print_test_logs.js
9897
env:
9998
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}

scripts/emulator-testing/emulators/emulator.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ export abstract class Emulator {
5656
const { name: tempDir } = tmp.dirSync({ unsafeCleanup: true });
5757
const filepath = path.resolve(tempDir, this.binaryName);
5858
return new Promise<void>((resolve, reject) => {
59-
// We want access to `this.binaryPath` after the download is finished, but we can't since in
60-
// `readChunk`, `this` is not inherited from the parent (since it's a named function expression).
61-
// To work around this, we wrap the fetch in a promise, then once it's resolved we can access `this` in the callback arrow function.
59+
/**
60+
* Once the download is `done` in `readChunk`, we want to set `this.binaryPath` to the path of the
61+
* downloaded emulator. Unfortunately, we can't access `this` when inside `readChunk`'s scope, since
62+
* it's a named function expression, and does not inherit the `this` object from it's parent.
63+
* To work around this, we wrap the fetch in a promise,
64+
* then once it's resolved we can access `this` in a callback arrow function that *does* inherit
65+
* `this` from the parent object, allowing us to set `this.binaryPath`.
66+
* Note that we can't make readChunk an arrow function, since it needs to be named so that we can
67+
* perform recursion to read the next chunk.
68+
*/
6269
const downloadPromise = new Promise<Uint8Array>(
6370
(downloadComplete, downloadFailed) => {
6471
fetch(this.binaryUrl)

0 commit comments

Comments
 (0)