summaryrefslogtreecommitdiff
path: root/std/node/process_test.ts
diff options
context:
space:
mode:
authorSteven Guerrero <stephenguerrero43@gmail.com>2020-11-16 14:44:37 -0500
committerGitHub <noreply@github.com>2020-11-16 14:44:37 -0500
commit8ab20a4582016542ac3d8140593f817ab920005f (patch)
tree0834ffa57b83ee03b69bf380c1bc660b99778169 /std/node/process_test.ts
parentdd9c2048849ec9bf0e1457a1bef431fd3f9be80d (diff)
feat(std/node): implement process.nextTick (#8386)
Diffstat (limited to 'std/node/process_test.ts')
-rw-r--r--std/node/process_test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/std/node/process_test.ts b/std/node/process_test.ts
index 6e6145e67..ee566853e 100644
--- a/std/node/process_test.ts
+++ b/std/node/process_test.ts
@@ -5,6 +5,7 @@ import { assert, assertEquals, assertThrows } from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import * as all from "./process.ts";
import { argv, env } from "./process.ts";
+import { delay } from "../async/delay.ts";
// NOTE: Deno.execPath() (and thus process.argv) currently requires --allow-env
// (Also Deno.env.toObject() (and process.env) requires --allow-env but it's more obvious)
@@ -164,3 +165,23 @@ Deno.test({
// assert(process.stderr.isTTY);
},
});
+
+Deno.test({
+ name: "process.nextTick",
+ async fn() {
+ let withoutArguments = false;
+ process.nextTick(() => {
+ withoutArguments = true;
+ });
+
+ const expected = 12;
+ let result;
+ process.nextTick((x: number) => {
+ result = x;
+ }, 12);
+
+ await delay(10);
+ assert(withoutArguments);
+ assertEquals(result, expected);
+ },
+});