Skip to content

Commit 7671a5d

Browse files
committed
Fix tests broken on Unix systems
1 parent a9b8cf3 commit 7671a5d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/DenoWorker.spec.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ describe('DenoWorker', () => {
121121
worker = new DenoWorker(failScript);
122122

123123
let exitCode: number;
124-
let exitStatus: string;
124+
let exitSignal: string;
125125
let resolve: any;
126126
let promise = new Promise((res, rej) => {
127127
resolve = res;
128128
});
129129
worker.onexit = (code, status) => {
130130
exitCode = code;
131-
exitStatus = status;
131+
exitSignal = status;
132132
resolve();
133133
};
134134

@@ -140,8 +140,15 @@ describe('DenoWorker', () => {
140140
await promise;
141141

142142
expect(ret).toBeUndefined();
143-
expect(exitCode).toBe(1);
144-
expect(exitStatus).toBe(null);
143+
144+
const isWindows = /^win/.test(process.platform);
145+
if (isWindows) {
146+
expect(exitCode).toBe(1);
147+
expect(exitSignal).toBe(null);
148+
} else {
149+
expect(exitCode).toBe(1);
150+
expect(exitSignal).toBe(null);
151+
}
145152
});
146153

147154
describe('denoUnstable', async () => {
@@ -1065,8 +1072,14 @@ describe('DenoWorker', () => {
10651072
denoProcesses = await getDenoProcesses();
10661073
expect(denoProcesses).toEqual([]);
10671074

1068-
expect(exitCode).toBe(1);
1069-
expect(exitSignal).toBe(null);
1075+
const isWindows = /^win/.test(process.platform);
1076+
if (isWindows) {
1077+
expect(exitCode).toBe(1);
1078+
expect(exitSignal).toBe(null);
1079+
} else {
1080+
expect(exitCode).toBe(null);
1081+
expect(exitSignal).toBe('SIGKILL');
1082+
}
10701083
});
10711084
});
10721085
});

0 commit comments

Comments
 (0)