Skip to content

Commit 538a5e4

Browse files
committed
fix unit tests to properly clean up node process tampering
1 parent b55b987 commit 538a5e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/emulator/downloadableEmulators.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ describe("downloadDetails", () => {
2121
pubsub: "",
2222
};
2323
let chmodStub: sinon.SinonStub;
24-
let originalProcessArch = process.arch;
24+
const originalProcessPlatform = process.platform;
25+
const originalProcessArch = process.arch;
2526
beforeEach(() => {
2627
chmodStub = sinon.stub(fs, "chmodSync").returns();
2728
tempEnvVars["firestore"] = process.env["FIRESTORE_EMULATOR_BINARY_PATH"] ?? "";
@@ -30,14 +31,14 @@ describe("downloadDetails", () => {
3031
delete process.env["FIRESTORE_EMULATOR_BINARY_PATH"];
3132
delete process.env["DATABASE_EMULATOR_BINARY_PATH"];
3233
delete process.env["PUBSUB_EMULATOR_BINARY_PATH"];
33-
originalProcessArch = process.arch;
3434
});
3535

3636
afterEach(() => {
3737
chmodStub.restore();
3838
process.env["FIRESTORE_EMULATOR_BINARY_PATH"] = tempEnvVars["firestore"];
3939
process.env["DATABASE_EMULATOR_BINARY_PATH"] = tempEnvVars["database"];
4040
process.env["PUBSUB_EMULATOR_BINARY_PATH"] = tempEnvVars["pubsub"];
41+
Object.defineProperty(process, "platform", { value: originalProcessPlatform });
4142
Object.defineProperty(process, "arch", { value: originalProcessArch });
4243
});
4344
it("should match the basename of remoteUrl", () => {

0 commit comments

Comments
 (0)