aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/process/process.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/node/process/process.test.js')
-rw-r--r--test/js/node/process/process.test.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/js/node/process/process.test.js b/test/js/node/process/process.test.js
index e32f34936..539a92f2c 100644
--- a/test/js/node/process/process.test.js
+++ b/test/js/node/process/process.test.js
@@ -317,7 +317,8 @@ describe("process.cpuUsage", () => {
it("works with diff", () => {
const init = process.cpuUsage();
- for (let i = 0; i < 1000; i++) {}
+ init.system = 1;
+ init.user = 1;
const delta = process.cpuUsage(init);
expect(delta.user).toBeGreaterThan(0);
expect(delta.system).toBeGreaterThan(0);
@@ -328,7 +329,6 @@ describe("process.cpuUsage", () => {
user: 0,
system: 0,
};
- for (let i = 0; i < 1000; i++) {}
const delta = process.cpuUsage(init);
expect(delta.user).toBeGreaterThan(0);
expect(delta.system).toBeGreaterThan(0);
@@ -478,3 +478,13 @@ for (const stub of emptyArrayStubs) {
expect(process[stub]).toHaveLength(0);
});
}
+
+it("dlopen args parsing", () => {
+ expect(() => process.dlopen({ module: "42" }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: 42 }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: "42" } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: 42 } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: Symbol() }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: Symbol("123") } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: Symbol("123") } }, Symbol("badddd"))).toThrow();
+});