diff options
author | 2022-11-23 07:14:33 -0800 | |
---|---|---|
committer | 2022-11-23 07:14:33 -0800 | |
commit | ac36ea51cfb85130403ac09299f8e1207bad4bcb (patch) | |
tree | a05bc2d34295bc0087b68b799155f18050451721 /test/bun.js/child_process-node.test.js | |
parent | ae3fcb5bd89a4ac908ba6d4cdb1be4e7c7f0ea81 (diff) | |
download | bun-ac36ea51cfb85130403ac09299f8e1207bad4bcb.tar.gz bun-ac36ea51cfb85130403ac09299f8e1207bad4bcb.tar.zst bun-ac36ea51cfb85130403ac09299f8e1207bad4bcb.zip |
possibly more reliable Bun.spawn (#1547)
* wip
* wip
* Fix bug with stdin
* zig fmt
* seems to work!
* Update streams.test.js
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/bun.js/child_process-node.test.js')
-rw-r--r-- | test/bun.js/child_process-node.test.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/bun.js/child_process-node.test.js b/test/bun.js/child_process-node.test.js index 908dc2a36..699b0e58c 100644 --- a/test/bun.js/child_process-node.test.js +++ b/test/bun.js/child_process-node.test.js @@ -1,4 +1,4 @@ -import { beforeAll, describe, it } from "bun:test"; +import { beforeAll, describe, it as it_ } from "bun:test"; import { ChildProcess, spawn, exec } from "node:child_process"; import { strictEqual, @@ -9,6 +9,36 @@ import { createDoneDotAll, } from "node-test-helpers"; import { tmpdir } from "node:os"; +import { gcTick } from "gc"; + +const it = (label, fn) => { + const hasDone = fn.length === 1; + if (fn.constructor.name === "AsyncFunction" && hasDone) { + return it_(label, async (done) => { + gcTick(); + await fn(done); + gcTick(); + }); + } else if (hasDone) { + return it_(label, (done) => { + gcTick(); + fn(done); + gcTick(); + }); + } else if (fn.constructor.name === "AsyncFunction") { + return it_(label, async () => { + gcTick(); + await fn(); + gcTick(); + }); + } else { + return it_(label, () => { + gcTick(); + fn(); + gcTick(); + }); + } +}; const debug = process.env.DEBUG ? console.log : () => {}; |