From d0efd040c79021958a1e83caa56572c0401ca1f2 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 31 May 2023 12:20:38 +0200 Subject: fix(node): add missing process.reallyExit method (#19326) This PR adds the missing `process.reallyExit()` method to node's `process` object. Was [pinged on twitter](https://twitter.com/biwanczuk/status/1663326659787862017) regarding running the `fastify` test suite in node. They use `node-tap` which has been around arguably the longest of the test frameworks and relies on a couple of old APIs. They have `signal-exit` as a dependency which in turn [makes use of `process.reallyExit()`](https://github.com/tapjs/signal-exit/blob/8fa7fc9a9c63f559af43d292b7eb727901775507/src/index.ts#L19). That function cannot be found anywhere in their documentation, but exists at runtime. See https://github.com/nodejs/node/blob/6a6b3c54022104cc110ab09044a2a0cecb8988e7/lib/internal/bootstrap/node.js#L172 This doesn't yet make `node-tap` work, but gets us one step closer. --- cli/tests/unit_node/process_test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cli/tests/unit_node/process_test.ts') diff --git a/cli/tests/unit_node/process_test.ts b/cli/tests/unit_node/process_test.ts index 686a3dbbc..49b753db3 100644 --- a/cli/tests/unit_node/process_test.ts +++ b/cli/tests/unit_node/process_test.ts @@ -727,3 +727,22 @@ Deno.test({ assertEquals(stripColor(decoder.decode(stdout).trim()), "exit"); }, }); + +Deno.test({ + name: "process.reallyExit", + async fn() { + const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "--quiet", + "--unstable", + "./testdata/process_really_exit.ts", + ], + cwd: testDir, + }); + const { stdout } = await command.output(); + + const decoder = new TextDecoder(); + assertEquals(stripColor(decoder.decode(stdout).trim()), "really exited"); + }, +}); -- cgit v1.2.3