Skip to content

Commit 9872e9a

Browse files
committed
socket: process?.env
1 parent b2b1e03 commit 9872e9a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

packages/socket/src/queueingstreamingsocket.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { ConnectionStatus, QueueingStreamingSocket } from "./queueingstreamingsocket";
22

33
function pendingWithoutSocketServer(): void {
4-
if (!process.env.SOCKETSERVER_ENABLED) {
5-
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
4+
if (typeof process !== "undefined" && process?.env.SOCKETSERVER_ENABLED) {
5+
return;
66
}
7+
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
78
}
89

910
describe("QueueingStreamingSocket", () => {

packages/socket/src/reconnectingsocket.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ type Exec = (command: string, callback: (error: null | (Error & { readonly code?
66
const getExec = async (): Promise<Exec | undefined> => (await import("child_process")).exec;
77

88
function pendingWithoutSocketServer(): void {
9-
if (!process.env.SOCKETSERVER_ENABLED) {
10-
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
9+
if (typeof process !== "undefined" && process?.env.SOCKETSERVER_ENABLED) {
10+
return;
1111
}
12+
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
1213
}
1314

1415
describe("ReconnectingSocket", () => {

packages/socket/src/socketwrapper.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { SocketWrapper } from "./socketwrapper";
22

33
function pendingWithoutSocketServer(): void {
4-
if (!process.env.SOCKETSERVER_ENABLED) {
5-
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
4+
if (typeof process !== "undefined" && process?.env.SOCKETSERVER_ENABLED) {
5+
return;
66
}
7+
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
78
}
89

910
describe("SocketWrapper", () => {

packages/socket/src/streamingsocket.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import { toListPromise } from "@cosmjs/stream";
22

33
import { StreamingSocket } from "./streamingsocket";
44

5-
function skipTests(): boolean {
6-
return !process.env.SOCKETSERVER_ENABLED;
7-
}
8-
95
function pendingWithoutSocketServer(): void {
10-
if (skipTests()) {
11-
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
6+
if (typeof process !== "undefined" && process?.env.SOCKETSERVER_ENABLED) {
7+
return;
128
}
9+
pending("Set SOCKETSERVER_ENABLED to enable socket tests");
1310
}
1411

1512
describe("StreamingSocket", () => {

0 commit comments

Comments
 (0)