1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(ext/node): stub process.cpuUsage() (#25462)

closes #23401
This commit is contained in:
Yoshiya Hinosawa 2024-09-05 21:21:29 +09:00 committed by GitHub
parent 5319b85f14
commit dda6328745
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -430,6 +430,14 @@ Process.prototype.config = {
},
};
Process.prototype.cpuUsage = function () {
warnNotImplemented("process.cpuUsage()");
return {
user: 0,
system: 0,
};
};
/** https://nodejs.org/api/process.html#process_process_cwd */
Process.prototype.cwd = cwd;

View file

@ -1131,3 +1131,9 @@ Deno.test(function importedExecArgvTest() {
Deno.test(function importedExecPathTest() {
assertEquals(importedExecPath, Deno.execPath());
});
Deno.test("process.cpuUsage()", () => {
const cpuUsage = process.cpuUsage();
assert(typeof cpuUsage.user === "number");
assert(typeof cpuUsage.system === "number");
});