-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node/cluster): improve stubs to make log4js work (#25146)
- Add missing exports to `node:cluster` - Fix default export not being an instance of `EventEmitter` - Fix aliasing of properties - Fix `disconnected` -> `disconnect` export naming This makes `log4js` work in Deno. `karma` starts too, but somehow the server isn't responding. That looks like a different issue. Fixes #24858
- Loading branch information
1 parent
7eaa395
commit 4cb7acb
Showing
3 changed files
with
91 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
import { assertEquals } from "@std/assert"; | ||
import cluster from "node:cluster"; | ||
import * as clusterNamed from "node:cluster"; | ||
|
||
Deno.test("[node/cluster] has all node exports", () => { | ||
assertEquals(cluster.isPrimary, true); | ||
assertEquals(cluster.isMaster, true); | ||
assertEquals(cluster.isWorker, false); | ||
assertEquals(typeof cluster.disconnect, "function"); | ||
assertEquals(typeof cluster.on, "function"); | ||
assertEquals(cluster.workers, {}); | ||
assertEquals(cluster.settings, {}); | ||
assertEquals(cluster.SCHED_NONE, 1); | ||
assertEquals(cluster.SCHED_RR, 2); | ||
assertEquals(typeof cluster.fork, "function"); | ||
assertEquals(typeof cluster.disconnect, "function"); | ||
assertEquals(typeof cluster.setupPrimary, "function"); | ||
assertEquals(cluster.setupPrimary, cluster.setupMaster); | ||
|
||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.setupPrimary, clusterNamed.setupPrimary); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.setupMaster, clusterNamed.setupMaster); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.workers, clusterNamed.workers); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.settings, clusterNamed.settings); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.fork, clusterNamed.fork); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.disconnect, clusterNamed.disconnect); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.SCHED_NONE, clusterNamed.SCHED_NONE); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.SCHED_RR, clusterNamed.SCHED_RR); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.isWorker, clusterNamed.isWorker); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.isPrimary, clusterNamed.isPrimary); | ||
// @ts-ignore Our @types/node version is too old | ||
assertEquals(cluster.isMaster, clusterNamed.isMaster); | ||
}); |