import { describe, it, expect, beforeAll } from "bun:test"; import { spawn, execSync } from "node:child_process"; import { bunExe } from "bunExe"; const CHILD_PROCESS_FILE = import.meta.dir + "/spawned-child.js"; const OUT_FILE = import.meta.dir + "/stdio-test-out.txt"; describe("process.stdout", () => { it("should allow us to write to it", (done) => { const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDOUT"]); child.stdout.setEncoding("utf8"); child.stdout.on("data", (data) => { try { expect(data).toBe("stdout_test"); done(); } catch (err) { done(err); } }); }); }); describe("process.stdin", () => { it("should allow us to read from stdin in readable mode", (done) => { const input = "hello\n"; // Child should read from stdin and write it back const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "READABLE"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("data", (chunk) => { data += chunk; }).on("end", function() { try { expect(data).toBe(`data: ${input}`); done(); } catch (err) { done(err); } }); child.stdin.write(input); child.stdin.end(); }); it("should allow us to read from stdin via flowing mode", (done) => { const input = "hello\n"; // Child should read from stdin and write it back const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("readable", () => { let chunk; while ((chunk = child.stdout.read()) !== null) { data += chunk; } }).on("end", function() { try { expect(data).toBe(`data: ${input}`); done(); } catch (err) { done(err); } }); child.stdin.write(input); child.stdin.end(); }); it("should allow us to read > 65kb from stdin", (done) => { const numReps = Math.ceil((66 * 1024) / 5); const input = "hello".repeat(numReps); // Child should read from stdin and write it back const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("readable", () => { let chunk; while ((chunk = child.stdout.read()) !== null) { data += chunk; } }).on("end", function() { try { expect(data).toBe(`data: ${input}`); done(); } catch (err) { done(err); } }); child.stdin.write(input); child.stdin.end(); }); it("should allow us to read from a file", () => { const result = execSync( `${bunExe()} ${CHILD_PROCESS_FILE} STDIN FLOWING < ${ import.meta.dir }/readFileSync.txt`, { encoding: "utf8" }, ); expect(result).toEqual("data: File read successfully"); }); }); ion value='db-tokens'>db-tokens Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs/src (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2021-08-03Fix portfolio example (#987)Gravatar Maksim Markelov 1-1/+1
2021-08-03Improve Collection docs for RSS (#990)Gravatar Joshua Stübner 1-1/+5
- Added missing but required link attribute - Added note on how to create a full text feed
2021-08-03Improve code sample for lit integration (#991)Gravatar tobi-or-not-tobi 1-4/+6
Align the lit component with the astro import and usage of it.
2021-08-03fix: Exclude remote srcset URLs (#986)Gravatar Maarten Van Hoof 2-1/+8
* fix: Exclude remote srcset URLs Fixed #985 * chore: add changeset for 'Exclude remote srcset URLs'
2021-08-03Make Astro.request available to all astro components (#960)Gravatar Matthew Phillips 7-15/+53
* Make Astro.request available to all astro components * Adds a changeset
2021-08-02Add `lang` variable to docs frontmatter for translations (#984)Gravatar Caleb Jasik 4-0/+4
2021-08-01Update styling.md re link-handling for .scss files (#977)Gravatar Bryce Wray 1-1/+3
Adding a note to make clear that users of .scss files should still link to the final compiled .css files, as per https://discord.com/channels/830184174198718474/853350631389265940/871151798075949066.
2021-08-01add support for 4-letter language codes (ex: zh-TW)Gravatar Fred K. Schott 1-1/+1
2021-08-02[ci] yarn formatGravatar FredKSchott 3-11/+10
2021-08-01full translation (#967)Gravatar Fred K. Schott 9-83/+85
2021-08-01Update CONTRIBUTING.mdGravatar Fred K. Schott 1-3/+3
2021-08-02[ci] yarn formatGravatar FredKSchott 1-3/+1
2021-08-01Update and rename contributing.md to CONTRIBUTING.mdGravatar Fred K. Schott 1-0/+29
2021-08-01Delete COMMUNITY.mdGravatar Fred K. Schott 1-15/+0
2021-07-31fix bad merge from outdated layoutGravatar Fred K. Schott 3-3/+3
2021-07-30Fixes throwing 404 (#894)Gravatar Maciej Palmowski 1-3/+0
* Fixes throwing 404 * Update index.css Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2021-07-30small cleanup to installation docsGravatar Fred K. Schott 1-9/+6
2021-07-30add finnish to language selectorGravatar Fred K. Schott 2-2/+5
2021-07-30move finnish translations to fiGravatar Fred K. Schott 3-0/+0
2021-07-30WIP: Documentation in Finnish (#837)Gravatar Vesa Piittinen 3-0/+201
* Initial Finnish getting-started.md * Initial Finnish `quick-start.md` * Missing word * Use a different test path name * Initial Finnish `installation.md` * Sync with `installation.md` * WIP Finnish island-architecture.md * Fix some sillyness * Delete island-architecture.md Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2021-07-30📘 DOC: Add PostCSS configuration on Astro (#947)Gravatar Diogo Felix 1-0/+27
2021-07-30fix styling URL linkGravatar Fred K. Schott 1-1/+1
2021-07-31[ci] yarn formatGravatar FredKSchott 6-36/+61
2021-07-30fix styling guide (#961)Gravatar Rubens de Melo 1-1/+1
* fix styling guide fix styling guide * remove /docs remove /docs
2021-07-30Add svelte file extension to tailwind puge configuration. (#964)Gravatar allanvobraun 1-1/+1
Self explanatory.
2021-07-30Docs site cleanup (#948)Gravatar Fred K. Schott 57-730/+739
* add language selector * docs site cleanup * review feedback * code review comments
2021-07-30Ascii quotes (#928)Gravatar Marcus Otterström 8-63/+63
2021-07-30forced degit template extraction in case of non empty installation directory ↵Gravatar mash-graz 2-23/+7
(#937) * revert recursive file removal routine * forced degit overwrite without previous file removal * add changeset
2021-07-30Version Packages (#940)Gravatar github-actions[bot] 26-34/+45
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-07-30[ci] yarn formatGravatar matthewp 1-1/+1
2021-07-30Fix Vue components nesting and add tests (#924)Gravatar Bartek Igielski 10-34/+171
* Allow @vue/server-renderer to be processed * Bump @vue/server-renderer version * Create twenty-coats-talk.md * Bump Vue packages version to get ESM builds * Add Vue components tests * Create shaggy-pugs-raise.md * Delete shaggy-pugs-raise.md
2021-07-30[ci] yarn formatGravatar FredKSchott 1-1/+0
2021-07-30Fix typos and clarify docs (#880)Gravatar Marcus Otterström 4-4/+5
* Add more missing words * Add missing dot * Add another missing dot * Clarify what optimized css means (discussed on Discord) * Remove oxford comma Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2021-07-29move translated nl docsGravatar Fred K. Schott 3-1/+1