typescript-virtual-container 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/builds/self-standalone.js +321 -272
- package/builds/self-standalone.js.map +4 -4
- package/builds/standalone-wo-sftp.js +262 -212
- package/builds/standalone-wo-sftp.js.map +4 -4
- package/builds/standalone.cjs +491 -0
- package/builds/standalone.cjs.map +7 -0
- package/builds/standalone.js +266 -216
- package/builds/standalone.js.map +4 -4
- package/builds/web-full-api.min.js +5 -5
- package/builds/web-full-api.min.js.map +3 -3
- package/builds/web.min.js +5 -5
- package/builds/web.min.js.map +3 -3
- package/bun.lock +97 -0
- package/dist/Honeypot/index.d.ts.map +1 -0
- package/dist/Honeypot/index.js +299 -0
- package/dist/Honeypot/index.js.map +1 -0
- package/dist/SSHClient/index.d.ts.map +1 -0
- package/dist/SSHClient/index.js +238 -0
- package/dist/SSHClient/index.js.map +1 -0
- package/dist/SSHMimic/exec.d.ts.map +1 -0
- package/dist/SSHMimic/exec.js +28 -0
- package/dist/SSHMimic/exec.js.map +1 -0
- package/dist/SSHMimic/executor.d.ts.map +1 -0
- package/dist/SSHMimic/executor.js +161 -0
- package/dist/SSHMimic/executor.js.map +1 -0
- package/dist/SSHMimic/hostKey.d.ts.map +1 -0
- package/dist/SSHMimic/hostKey.js +18 -0
- package/dist/SSHMimic/hostKey.js.map +1 -0
- package/dist/SSHMimic/index.d.ts.map +1 -0
- package/dist/SSHMimic/index.js +250 -0
- package/dist/SSHMimic/index.js.map +1 -0
- package/dist/SSHMimic/loginBanner.d.ts.map +1 -0
- package/dist/SSHMimic/loginBanner.js +23 -0
- package/dist/SSHMimic/loginBanner.js.map +1 -0
- package/dist/SSHMimic/loginFormat.d.ts.map +1 -0
- package/dist/SSHMimic/loginFormat.js +11 -0
- package/dist/SSHMimic/loginFormat.js.map +1 -0
- package/dist/SSHMimic/prompt.d.ts.map +1 -0
- package/dist/SSHMimic/prompt.js +10 -0
- package/dist/SSHMimic/prompt.js.map +1 -0
- package/dist/SSHMimic/sftp.d.ts.map +1 -0
- package/dist/SSHMimic/sftp.js +620 -0
- package/dist/SSHMimic/sftp.js.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +1 -0
- package/dist/VirtualFileSystem/binaryPack.js +217 -0
- package/dist/VirtualFileSystem/binaryPack.js.map +1 -0
- package/dist/VirtualFileSystem/index.d.ts.map +1 -0
- package/dist/VirtualFileSystem/index.js +690 -0
- package/dist/VirtualFileSystem/index.js.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.d.ts.map +1 -0
- package/dist/VirtualFileSystem/internalTypes.js +1 -0
- package/dist/VirtualFileSystem/internalTypes.js.map +1 -0
- package/dist/VirtualFileSystem/path.d.ts.map +1 -0
- package/dist/VirtualFileSystem/path.js +50 -0
- package/dist/VirtualFileSystem/path.js.map +1 -0
- package/dist/VirtualPackageManager/index.d.ts.map +1 -0
- package/dist/VirtualPackageManager/index.js +854 -0
- package/dist/VirtualPackageManager/index.js.map +1 -0
- package/dist/VirtualShell/index.d.ts.map +1 -0
- package/dist/VirtualShell/index.js +285 -0
- package/dist/VirtualShell/index.js.map +1 -0
- package/dist/VirtualShell/shell.d.ts.map +1 -0
- package/dist/VirtualShell/shell.js +503 -0
- package/dist/VirtualShell/shell.js.map +1 -0
- package/dist/VirtualShell/shellParser.d.ts.map +1 -0
- package/dist/VirtualShell/shellParser.js +266 -0
- package/dist/VirtualShell/shellParser.js.map +1 -0
- package/dist/VirtualUserManager/index.d.ts.map +1 -0
- package/dist/VirtualUserManager/index.js +608 -0
- package/dist/VirtualUserManager/index.js.map +1 -0
- package/dist/commands/adduser.d.ts.map +1 -0
- package/dist/commands/adduser.js +90 -0
- package/dist/commands/adduser.js.map +1 -0
- package/dist/commands/alias.d.ts.map +1 -0
- package/dist/commands/alias.js +69 -0
- package/dist/commands/alias.js.map +1 -0
- package/dist/commands/apt.d.ts.map +1 -0
- package/dist/commands/apt.js +211 -0
- package/dist/commands/apt.js.map +1 -0
- package/dist/commands/awk.d.ts.map +1 -0
- package/dist/commands/awk.js +170 -0
- package/dist/commands/awk.js.map +1 -0
- package/dist/commands/base64.d.ts.map +1 -0
- package/dist/commands/base64.js +29 -0
- package/dist/commands/base64.js.map +1 -0
- package/dist/commands/cat.d.ts.map +1 -0
- package/dist/commands/cat.js +45 -0
- package/dist/commands/cat.js.map +1 -0
- package/dist/commands/cd.d.ts.map +1 -0
- package/dist/commands/cd.js +22 -0
- package/dist/commands/cd.js.map +1 -0
- package/dist/commands/chmod.d.ts.map +1 -0
- package/dist/commands/chmod.js +88 -0
- package/dist/commands/chmod.js.map +1 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +14 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/command-helpers.d.ts.map +1 -0
- package/dist/commands/command-helpers.js +222 -0
- package/dist/commands/command-helpers.js.map +1 -0
- package/dist/commands/cp.d.ts.map +1 -0
- package/dist/commands/cp.js +76 -0
- package/dist/commands/cp.js.map +1 -0
- package/dist/commands/curl.d.ts.map +1 -0
- package/dist/commands/curl.js +128 -0
- package/dist/commands/curl.js.map +1 -0
- package/dist/commands/cut.d.ts.map +1 -0
- package/dist/commands/cut.js +35 -0
- package/dist/commands/cut.js.map +1 -0
- package/dist/commands/date.d.ts.map +1 -0
- package/dist/commands/date.js +29 -0
- package/dist/commands/date.js.map +1 -0
- package/dist/commands/declare.d.ts.map +1 -0
- package/dist/commands/declare.js +45 -0
- package/dist/commands/declare.js.map +1 -0
- package/dist/commands/deluser.d.ts.map +1 -0
- package/dist/commands/deluser.js +84 -0
- package/dist/commands/deluser.js.map +1 -0
- package/dist/commands/df.d.ts.map +1 -0
- package/dist/commands/df.js +22 -0
- package/dist/commands/df.js.map +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +46 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/dpkg.d.ts.map +1 -0
- package/dist/commands/dpkg.js +162 -0
- package/dist/commands/dpkg.js.map +1 -0
- package/dist/commands/du.d.ts.map +1 -0
- package/dist/commands/du.js +51 -0
- package/dist/commands/du.js.map +1 -0
- package/dist/commands/echo.d.ts.map +1 -0
- package/dist/commands/echo.js +46 -0
- package/dist/commands/echo.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +21 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/exit.d.ts.map +1 -0
- package/dist/commands/exit.js +17 -0
- package/dist/commands/exit.js.map +1 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +34 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/find.d.ts.map +1 -0
- package/dist/commands/find.js +56 -0
- package/dist/commands/find.js.map +1 -0
- package/dist/commands/free.d.ts.map +1 -0
- package/dist/commands/free.js +44 -0
- package/dist/commands/free.js.map +1 -0
- package/dist/commands/grep.d.ts.map +1 -0
- package/dist/commands/grep.js +121 -0
- package/dist/commands/grep.js.map +1 -0
- package/dist/commands/groups.d.ts.map +1 -0
- package/dist/commands/groups.js +18 -0
- package/dist/commands/groups.js.map +1 -0
- package/dist/commands/gzip.d.ts.map +1 -0
- package/dist/commands/gzip.js +83 -0
- package/dist/commands/gzip.js.map +1 -0
- package/dist/commands/head.d.ts.map +1 -0
- package/dist/commands/head.js +47 -0
- package/dist/commands/head.js.map +1 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +124 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +167 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +27 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/hostname.d.ts.map +1 -0
- package/dist/commands/hostname.js +13 -0
- package/dist/commands/hostname.js.map +1 -0
- package/dist/commands/htop.d.ts.map +1 -0
- package/dist/commands/htop.js +18 -0
- package/dist/commands/htop.js.map +1 -0
- package/dist/commands/id.d.ts.map +1 -0
- package/dist/commands/id.js +18 -0
- package/dist/commands/id.js.map +1 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/kill.d.ts.map +1 -0
- package/dist/commands/kill.js +19 -0
- package/dist/commands/kill.js.map +1 -0
- package/dist/commands/ln.d.ts.map +1 -0
- package/dist/commands/ln.js +67 -0
- package/dist/commands/ln.js.map +1 -0
- package/dist/commands/ls.d.ts.map +1 -0
- package/dist/commands/ls.js +201 -0
- package/dist/commands/ls.js.map +1 -0
- package/dist/commands/lsb-release.d.ts.map +1 -0
- package/dist/commands/lsb-release.js +62 -0
- package/dist/commands/lsb-release.js.map +1 -0
- package/dist/commands/man.d.ts.map +1 -0
- package/dist/commands/man.js +50 -0
- package/dist/commands/man.js.map +1 -0
- package/dist/commands/mkdir.d.ts.map +1 -0
- package/dist/commands/mkdir.js +29 -0
- package/dist/commands/mkdir.js.map +1 -0
- package/dist/commands/mv.d.ts.map +1 -0
- package/dist/commands/mv.js +43 -0
- package/dist/commands/mv.js.map +1 -0
- package/dist/commands/nano.d.ts.map +1 -0
- package/dist/commands/nano.js +35 -0
- package/dist/commands/nano.js.map +1 -0
- package/dist/commands/neofetch.d.ts.map +1 -0
- package/dist/commands/neofetch.js +49 -0
- package/dist/commands/neofetch.js.map +1 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +317 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/npm.d.ts.map +1 -0
- package/dist/commands/npm.js +110 -0
- package/dist/commands/npm.js.map +1 -0
- package/dist/commands/passwd.d.ts.map +1 -0
- package/dist/commands/passwd.js +45 -0
- package/dist/commands/passwd.js.map +1 -0
- package/dist/commands/ping.d.ts.map +1 -0
- package/dist/commands/ping.js +29 -0
- package/dist/commands/ping.js.map +1 -0
- package/dist/commands/printf.d.ts.map +1 -0
- package/dist/commands/printf.js +145 -0
- package/dist/commands/printf.js.map +1 -0
- package/dist/commands/ps.d.ts.map +1 -0
- package/dist/commands/ps.js +47 -0
- package/dist/commands/ps.js.map +1 -0
- package/dist/commands/pwd.d.ts.map +1 -0
- package/dist/commands/pwd.js +8 -0
- package/dist/commands/pwd.js.map +1 -0
- package/dist/commands/python.d.ts.map +1 -0
- package/dist/commands/python.js +2059 -0
- package/dist/commands/python.js.map +1 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +40 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +235 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/rm.d.ts.map +1 -0
- package/dist/commands/rm.js +37 -0
- package/dist/commands/rm.js.map +1 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +286 -0
- package/dist/commands/runtime.js.map +1 -0
- package/dist/commands/sed.d.ts.map +1 -0
- package/dist/commands/sed.js +61 -0
- package/dist/commands/sed.js.map +1 -0
- package/dist/commands/seq.d.ts.map +1 -0
- package/dist/commands/seq.js +51 -0
- package/dist/commands/seq.js.map +1 -0
- package/dist/commands/set.d.ts.map +1 -0
- package/dist/commands/set.js +27 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/sh.d.ts.map +1 -0
- package/dist/commands/sh.js +432 -0
- package/dist/commands/sh.js.map +1 -0
- package/dist/commands/shift.d.ts.map +1 -0
- package/dist/commands/shift.js +63 -0
- package/dist/commands/shift.js.map +1 -0
- package/dist/commands/sleep.d.ts.map +1 -0
- package/dist/commands/sleep.js +19 -0
- package/dist/commands/sleep.js.map +1 -0
- package/dist/commands/sort.d.ts.map +1 -0
- package/dist/commands/sort.js +45 -0
- package/dist/commands/sort.js.map +1 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +40 -0
- package/dist/commands/source.js.map +1 -0
- package/dist/commands/stat.d.ts.map +1 -0
- package/dist/commands/stat.js +57 -0
- package/dist/commands/stat.js.map +1 -0
- package/dist/commands/su.d.ts.map +1 -0
- package/dist/commands/su.js +58 -0
- package/dist/commands/su.js.map +1 -0
- package/dist/commands/sudo.d.ts.map +1 -0
- package/dist/commands/sudo.js +55 -0
- package/dist/commands/sudo.js.map +1 -0
- package/dist/commands/tail.d.ts.map +1 -0
- package/dist/commands/tail.js +48 -0
- package/dist/commands/tail.js.map +1 -0
- package/dist/commands/tar.d.ts.map +1 -0
- package/dist/commands/tar.js +103 -0
- package/dist/commands/tar.js.map +1 -0
- package/dist/commands/tee.d.ts.map +1 -0
- package/dist/commands/tee.js +37 -0
- package/dist/commands/tee.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +115 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/touch.d.ts.map +1 -0
- package/dist/commands/touch.js +26 -0
- package/dist/commands/touch.js.map +1 -0
- package/dist/commands/tr.d.ts.map +1 -0
- package/dist/commands/tr.js +62 -0
- package/dist/commands/tr.js.map +1 -0
- package/dist/commands/tree.d.ts.map +1 -0
- package/dist/commands/tree.js +19 -0
- package/dist/commands/tree.js.map +1 -0
- package/dist/commands/true.d.ts.map +1 -0
- package/dist/commands/true.js +25 -0
- package/dist/commands/true.js.map +1 -0
- package/dist/commands/type.d.ts.map +1 -0
- package/dist/commands/type.js +40 -0
- package/dist/commands/type.js.map +1 -0
- package/dist/commands/uname.d.ts.map +1 -0
- package/dist/commands/uname.js +30 -0
- package/dist/commands/uname.js.map +1 -0
- package/dist/commands/uniq.d.ts.map +1 -0
- package/dist/commands/uniq.js +39 -0
- package/dist/commands/uniq.js.map +1 -0
- package/dist/commands/unset.d.ts.map +1 -0
- package/dist/commands/unset.js +17 -0
- package/dist/commands/unset.js.map +1 -0
- package/dist/commands/uptime.d.ts.map +1 -0
- package/dist/commands/uptime.js +49 -0
- package/dist/commands/uptime.js.map +1 -0
- package/dist/commands/wc.d.ts.map +1 -0
- package/dist/commands/wc.js +56 -0
- package/dist/commands/wc.js.map +1 -0
- package/dist/commands/wget.d.ts.map +1 -0
- package/dist/commands/wget.js +127 -0
- package/dist/commands/wget.js.map +1 -0
- package/dist/commands/which.d.ts.map +1 -0
- package/dist/commands/which.js +33 -0
- package/dist/commands/which.js.map +1 -0
- package/dist/commands/who.d.ts.map +1 -0
- package/dist/commands/who.js +23 -0
- package/dist/commands/who.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +13 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/commands/xargs.d.ts.map +1 -0
- package/dist/commands/xargs.js +22 -0
- package/dist/commands/xargs.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/linuxRootfs.d.ts.map +1 -0
- package/dist/modules/linuxRootfs.js +620 -0
- package/dist/modules/linuxRootfs.js.map +1 -0
- package/dist/modules/neofetch.d.ts.map +1 -0
- package/dist/modules/neofetch.js +285 -0
- package/dist/modules/neofetch.js.map +1 -0
- package/dist/modules/shellInteractive.d.ts.map +1 -0
- package/dist/modules/shellInteractive.js +27 -0
- package/dist/modules/shellInteractive.js.map +1 -0
- package/dist/modules/shellRuntime.d.ts.map +1 -0
- package/dist/modules/shellRuntime.js +53 -0
- package/dist/modules/shellRuntime.js.map +1 -0
- package/dist/self-standalone.d.ts.map +1 -0
- package/dist/self-standalone.js +420 -0
- package/dist/self-standalone.js.map +1 -0
- package/dist/standalone-wo-sftp.d.ts.map +1 -0
- package/dist/standalone-wo-sftp.js +31 -0
- package/dist/standalone-wo-sftp.js.map +1 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +40 -0
- package/dist/standalone.js.map +1 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +1 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +1 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +1 -0
- package/dist/types/streams.js.map +1 -0
- package/dist/types/vfs.d.ts.map +1 -0
- package/dist/types/vfs.js +1 -0
- package/dist/types/vfs.js.map +1 -0
- package/dist/utils/expand.d.ts.map +1 -0
- package/dist/utils/expand.js +477 -0
- package/dist/utils/expand.js.map +1 -0
- package/dist/utils/perfLogger.d.ts.map +1 -0
- package/dist/utils/perfLogger.js +50 -0
- package/dist/utils/perfLogger.js.map +1 -0
- package/dist/utils/tokenize.d.ts.map +1 -0
- package/dist/utils/tokenize.js +115 -0
- package/dist/utils/tokenize.js.map +1 -0
- package/dist/utils/vfsDiff.d.ts.map +1 -0
- package/dist/utils/vfsDiff.js +178 -0
- package/dist/utils/vfsDiff.js.map +1 -0
- package/dist/web-api.d.ts.map +1 -0
- package/dist/web-api.js +47 -0
- package/dist/web-api.js.map +1 -0
- package/dist/web-full.d.ts.map +1 -0
- package/dist/web-full.js +9 -0
- package/dist/web-full.js.map +1 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +774 -0
- package/dist/web.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +162 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/HoneyPot.html +31 -0
- package/docs/classes/SshClient.html +66 -0
- package/docs/classes/VirtualFileSystem.html +262 -0
- package/docs/classes/VirtualPackageManager.html +63 -0
- package/docs/classes/VirtualSftpServer.html +169 -0
- package/docs/classes/VirtualShell.html +265 -0
- package/docs/classes/VirtualSshServer.html +177 -0
- package/docs/classes/VirtualUserManager.html +276 -0
- package/docs/functions/assertDiff.html +6 -0
- package/docs/functions/diffSnapshots.html +7 -0
- package/docs/functions/formatDiff.html +6 -0
- package/docs/functions/getArg.html +13 -0
- package/docs/functions/getFlag.html +15 -0
- package/docs/functions/ifFlag.html +11 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1842 -0
- package/docs/interfaces/AuditLogEntry.html +6 -0
- package/docs/interfaces/CommandContext.html +22 -0
- package/docs/interfaces/CommandResult.html +26 -0
- package/docs/interfaces/ExecStream.html +11 -0
- package/docs/interfaces/HoneyPotStats.html +14 -0
- package/docs/interfaces/InstalledPackage.html +20 -0
- package/docs/interfaces/NanoEditorSession.html +8 -0
- package/docs/interfaces/PackageDefinition.html +30 -0
- package/docs/interfaces/PackageFile.html +8 -0
- package/docs/interfaces/RemoveOptions.html +4 -0
- package/docs/interfaces/ShellEnv.html +6 -0
- package/docs/interfaces/ShellModule.html +14 -0
- package/docs/interfaces/ShellProperties.html +14 -0
- package/docs/interfaces/ShellStream.html +11 -0
- package/docs/interfaces/SudoChallenge.html +24 -0
- package/docs/interfaces/VfsBaseNode.html +12 -0
- package/docs/interfaces/VfsDiff.html +10 -0
- package/docs/interfaces/VfsDiffEntry.html +6 -0
- package/docs/interfaces/VfsDiffModified.html +10 -0
- package/docs/interfaces/VfsDirectoryNode.html +15 -0
- package/docs/interfaces/VfsFileNode.html +17 -0
- package/docs/interfaces/VfsOptions.html +12 -0
- package/docs/interfaces/VfsSnapshot.html +3 -0
- package/docs/interfaces/VfsSnapshotBaseNode.html +8 -0
- package/docs/interfaces/VfsSnapshotDirectoryNode.html +10 -0
- package/docs/interfaces/VfsSnapshotFileNode.html +12 -0
- package/docs/interfaces/WriteFileOptions.html +6 -0
- package/docs/media/LICENSE +21 -0
- package/docs/modules.html +1 -0
- package/docs/types/CommandMode.html +2 -0
- package/docs/types/CommandOutcome.html +2 -0
- package/docs/types/VfsNodeStats.html +2 -0
- package/docs/types/VfsNodeType.html +2 -0
- package/docs/types/VfsPersistenceMode.html +5 -0
- package/docs/types/VfsSnapshotNode.html +2 -0
- package/examples/web.min.js +5 -5
- package/package.json +6 -4
- package/src/commands/man.ts +1 -1
- package/src/self-standalone.ts +1 -1
- package/src/standalone.ts +8 -3
- package/tsconfig.json +7 -2
- package/src/Honeypot/index.d.ts.map +0 -1
- package/src/Honeypot/index.js +0 -298
- package/src/SSHClient/index.d.ts.map +0 -1
- package/src/SSHClient/index.js +0 -237
- package/src/SSHMimic/exec.d.ts.map +0 -1
- package/src/SSHMimic/exec.js +0 -27
- package/src/SSHMimic/executor.d.ts.map +0 -1
- package/src/SSHMimic/executor.js +0 -160
- package/src/SSHMimic/hostKey.d.ts.map +0 -1
- package/src/SSHMimic/hostKey.js +0 -17
- package/src/SSHMimic/index.d.ts.map +0 -1
- package/src/SSHMimic/index.js +0 -249
- package/src/SSHMimic/loginBanner.d.ts.map +0 -1
- package/src/SSHMimic/loginBanner.js +0 -22
- package/src/SSHMimic/loginFormat.d.ts.map +0 -1
- package/src/SSHMimic/loginFormat.js +0 -10
- package/src/SSHMimic/prompt.d.ts.map +0 -1
- package/src/SSHMimic/prompt.js +0 -9
- package/src/SSHMimic/sftp.d.ts.map +0 -1
- package/src/SSHMimic/sftp.js +0 -619
- package/src/VirtualFileSystem/binaryPack.d.ts.map +0 -1
- package/src/VirtualFileSystem/binaryPack.js +0 -216
- package/src/VirtualFileSystem/index.d.ts.map +0 -1
- package/src/VirtualFileSystem/index.js +0 -689
- package/src/VirtualFileSystem/internalTypes.d.ts.map +0 -1
- package/src/VirtualFileSystem/internalTypes.js +0 -0
- package/src/VirtualFileSystem/path.d.ts.map +0 -1
- package/src/VirtualFileSystem/path.js +0 -49
- package/src/VirtualPackageManager/index.d.ts.map +0 -1
- package/src/VirtualPackageManager/index.js +0 -853
- package/src/VirtualShell/index.d.ts.map +0 -1
- package/src/VirtualShell/index.js +0 -284
- package/src/VirtualShell/shell.d.ts.map +0 -1
- package/src/VirtualShell/shell.js +0 -502
- package/src/VirtualShell/shellParser.d.ts.map +0 -1
- package/src/VirtualShell/shellParser.js +0 -265
- package/src/VirtualUserManager/index.d.ts.map +0 -1
- package/src/VirtualUserManager/index.js +0 -607
- package/src/commands/adduser.d.ts.map +0 -1
- package/src/commands/adduser.js +0 -89
- package/src/commands/alias.d.ts.map +0 -1
- package/src/commands/alias.js +0 -68
- package/src/commands/apt.d.ts.map +0 -1
- package/src/commands/apt.js +0 -210
- package/src/commands/awk.d.ts.map +0 -1
- package/src/commands/awk.js +0 -169
- package/src/commands/base64.d.ts.map +0 -1
- package/src/commands/base64.js +0 -28
- package/src/commands/cat.d.ts.map +0 -1
- package/src/commands/cat.js +0 -44
- package/src/commands/cd.d.ts.map +0 -1
- package/src/commands/cd.js +0 -21
- package/src/commands/chmod.d.ts.map +0 -1
- package/src/commands/chmod.js +0 -87
- package/src/commands/clear.d.ts.map +0 -1
- package/src/commands/clear.js +0 -13
- package/src/commands/command-helpers.d.ts.map +0 -1
- package/src/commands/command-helpers.js +0 -221
- package/src/commands/cp.d.ts.map +0 -1
- package/src/commands/cp.js +0 -75
- package/src/commands/curl.d.ts.map +0 -1
- package/src/commands/curl.js +0 -127
- package/src/commands/cut.d.ts.map +0 -1
- package/src/commands/cut.js +0 -34
- package/src/commands/date.d.ts.map +0 -1
- package/src/commands/date.js +0 -28
- package/src/commands/declare.d.ts.map +0 -1
- package/src/commands/declare.js +0 -44
- package/src/commands/deluser.d.ts.map +0 -1
- package/src/commands/deluser.js +0 -83
- package/src/commands/df.d.ts.map +0 -1
- package/src/commands/df.js +0 -21
- package/src/commands/diff.d.ts.map +0 -1
- package/src/commands/diff.js +0 -45
- package/src/commands/dpkg.d.ts.map +0 -1
- package/src/commands/dpkg.js +0 -161
- package/src/commands/du.d.ts.map +0 -1
- package/src/commands/du.js +0 -50
- package/src/commands/echo.d.ts.map +0 -1
- package/src/commands/echo.js +0 -45
- package/src/commands/env.d.ts.map +0 -1
- package/src/commands/env.js +0 -20
- package/src/commands/exit.d.ts.map +0 -1
- package/src/commands/exit.js +0 -16
- package/src/commands/export.d.ts.map +0 -1
- package/src/commands/export.js +0 -33
- package/src/commands/find.d.ts.map +0 -1
- package/src/commands/find.js +0 -55
- package/src/commands/free.d.ts.map +0 -1
- package/src/commands/free.js +0 -43
- package/src/commands/grep.d.ts.map +0 -1
- package/src/commands/grep.js +0 -120
- package/src/commands/groups.d.ts.map +0 -1
- package/src/commands/groups.js +0 -17
- package/src/commands/gzip.d.ts.map +0 -1
- package/src/commands/gzip.js +0 -82
- package/src/commands/head.d.ts.map +0 -1
- package/src/commands/head.js +0 -46
- package/src/commands/help.d.ts.map +0 -1
- package/src/commands/help.js +0 -123
- package/src/commands/helpers.d.ts.map +0 -1
- package/src/commands/helpers.js +0 -166
- package/src/commands/history.d.ts.map +0 -1
- package/src/commands/history.js +0 -26
- package/src/commands/hostname.d.ts.map +0 -1
- package/src/commands/hostname.js +0 -12
- package/src/commands/htop.d.ts.map +0 -1
- package/src/commands/htop.js +0 -17
- package/src/commands/id.d.ts.map +0 -1
- package/src/commands/id.js +0 -17
- package/src/commands/index.d.ts.map +0 -1
- package/src/commands/index.js +0 -2
- package/src/commands/kill.d.ts.map +0 -1
- package/src/commands/kill.js +0 -18
- package/src/commands/ln.d.ts.map +0 -1
- package/src/commands/ln.js +0 -66
- package/src/commands/ls.d.ts.map +0 -1
- package/src/commands/ls.js +0 -200
- package/src/commands/lsb-release.d.ts.map +0 -1
- package/src/commands/lsb-release.js +0 -61
- package/src/commands/man.d.ts.map +0 -1
- package/src/commands/man.js +0 -49
- package/src/commands/mkdir.d.ts.map +0 -1
- package/src/commands/mkdir.js +0 -28
- package/src/commands/mv.d.ts.map +0 -1
- package/src/commands/mv.js +0 -42
- package/src/commands/nano.d.ts.map +0 -1
- package/src/commands/nano.js +0 -34
- package/src/commands/neofetch.d.ts.map +0 -1
- package/src/commands/neofetch.js +0 -48
- package/src/commands/node.d.ts.map +0 -1
- package/src/commands/node.js +0 -316
- package/src/commands/npm.d.ts.map +0 -1
- package/src/commands/npm.js +0 -109
- package/src/commands/passwd.d.ts.map +0 -1
- package/src/commands/passwd.js +0 -44
- package/src/commands/ping.d.ts.map +0 -1
- package/src/commands/ping.js +0 -28
- package/src/commands/printf.d.ts.map +0 -1
- package/src/commands/printf.js +0 -144
- package/src/commands/ps.d.ts.map +0 -1
- package/src/commands/ps.js +0 -46
- package/src/commands/pwd.d.ts.map +0 -1
- package/src/commands/pwd.js +0 -7
- package/src/commands/python.d.ts.map +0 -1
- package/src/commands/python.js +0 -2058
- package/src/commands/read.d.ts.map +0 -1
- package/src/commands/read.js +0 -39
- package/src/commands/registry.d.ts.map +0 -1
- package/src/commands/registry.js +0 -234
- package/src/commands/rm.d.ts.map +0 -1
- package/src/commands/rm.js +0 -36
- package/src/commands/runtime.d.ts.map +0 -1
- package/src/commands/runtime.js +0 -285
- package/src/commands/sed.d.ts.map +0 -1
- package/src/commands/sed.js +0 -60
- package/src/commands/seq.d.ts.map +0 -1
- package/src/commands/seq.js +0 -50
- package/src/commands/set.d.ts.map +0 -1
- package/src/commands/set.js +0 -26
- package/src/commands/sh.d.ts.map +0 -1
- package/src/commands/sh.js +0 -431
- package/src/commands/shift.d.ts.map +0 -1
- package/src/commands/shift.js +0 -62
- package/src/commands/sleep.d.ts.map +0 -1
- package/src/commands/sleep.js +0 -18
- package/src/commands/sort.d.ts.map +0 -1
- package/src/commands/sort.js +0 -44
- package/src/commands/source.d.ts.map +0 -1
- package/src/commands/source.js +0 -39
- package/src/commands/stat.d.ts.map +0 -1
- package/src/commands/stat.js +0 -56
- package/src/commands/su.d.ts.map +0 -1
- package/src/commands/su.js +0 -57
- package/src/commands/sudo.d.ts.map +0 -1
- package/src/commands/sudo.js +0 -54
- package/src/commands/tail.d.ts.map +0 -1
- package/src/commands/tail.js +0 -47
- package/src/commands/tar.d.ts.map +0 -1
- package/src/commands/tar.js +0 -102
- package/src/commands/tee.d.ts.map +0 -1
- package/src/commands/tee.js +0 -36
- package/src/commands/test.d.ts.map +0 -1
- package/src/commands/test.js +0 -114
- package/src/commands/touch.d.ts.map +0 -1
- package/src/commands/touch.js +0 -25
- package/src/commands/tr.d.ts.map +0 -1
- package/src/commands/tr.js +0 -61
- package/src/commands/tree.d.ts.map +0 -1
- package/src/commands/tree.js +0 -18
- package/src/commands/true.d.ts.map +0 -1
- package/src/commands/true.js +0 -24
- package/src/commands/type.d.ts.map +0 -1
- package/src/commands/type.js +0 -39
- package/src/commands/uname.d.ts.map +0 -1
- package/src/commands/uname.js +0 -29
- package/src/commands/uniq.d.ts.map +0 -1
- package/src/commands/uniq.js +0 -38
- package/src/commands/unset.d.ts.map +0 -1
- package/src/commands/unset.js +0 -16
- package/src/commands/uptime.d.ts.map +0 -1
- package/src/commands/uptime.js +0 -48
- package/src/commands/wc.d.ts.map +0 -1
- package/src/commands/wc.js +0 -55
- package/src/commands/wget.d.ts.map +0 -1
- package/src/commands/wget.js +0 -126
- package/src/commands/which.d.ts.map +0 -1
- package/src/commands/which.js +0 -32
- package/src/commands/who.d.ts.map +0 -1
- package/src/commands/who.js +0 -22
- package/src/commands/whoami.d.ts.map +0 -1
- package/src/commands/whoami.js +0 -12
- package/src/commands/xargs.d.ts.map +0 -1
- package/src/commands/xargs.js +0 -21
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -9
- package/src/modules/linuxRootfs.d.ts.map +0 -1
- package/src/modules/linuxRootfs.js +0 -619
- package/src/modules/neofetch.d.ts.map +0 -1
- package/src/modules/neofetch.js +0 -284
- package/src/modules/shellInteractive.d.ts.map +0 -1
- package/src/modules/shellInteractive.js +0 -26
- package/src/modules/shellRuntime.d.ts.map +0 -1
- package/src/modules/shellRuntime.js +0 -52
- package/src/self-standalone.d.ts.map +0 -1
- package/src/self-standalone.js +0 -418
- package/src/standalone-wo-sftp.d.ts.map +0 -1
- package/src/standalone-wo-sftp.js +0 -30
- package/src/standalone.d.ts.map +0 -1
- package/src/standalone.js +0 -35
- package/src/types/commands.d.ts.map +0 -1
- package/src/types/commands.js +0 -0
- package/src/types/pipeline.d.ts.map +0 -1
- package/src/types/pipeline.js +0 -0
- package/src/types/streams.d.ts.map +0 -1
- package/src/types/streams.js +0 -0
- package/src/types/vfs.d.ts.map +0 -1
- package/src/types/vfs.js +0 -0
- package/src/utils/expand.d.ts.map +0 -1
- package/src/utils/expand.js +0 -476
- package/src/utils/perfLogger.d.ts.map +0 -1
- package/src/utils/perfLogger.js +0 -49
- package/src/utils/tokenize.d.ts.map +0 -1
- package/src/utils/tokenize.js +0 -114
- package/src/utils/vfsDiff.d.ts.map +0 -1
- package/src/utils/vfsDiff.js +0 -177
- package/src/web-api.d.ts.map +0 -1
- package/src/web-api.js +0 -46
- package/src/web-full.d.ts.map +0 -1
- package/src/web-full.js +0 -8
- package/src/web.d.ts.map +0 -1
- package/src/web.js +0 -773
- package/tests/command-helpers.test.d.ts +0 -2
- package/tests/command-helpers.test.d.ts.map +0 -1
- package/tests/command-helpers.test.js +0 -92
- package/tests/commands-admin-net.test.d.ts +0 -2
- package/tests/commands-admin-net.test.d.ts.map +0 -1
- package/tests/commands-admin-net.test.js +0 -353
- package/tests/commands-advanced.test.d.ts +0 -2
- package/tests/commands-advanced.test.d.ts.map +0 -1
- package/tests/commands-advanced.test.js +0 -378
- package/tests/commands-core.test.d.ts +0 -2
- package/tests/commands-core.test.d.ts.map +0 -1
- package/tests/commands-core.test.js +0 -477
- package/tests/commands-missing.test.d.ts +0 -2
- package/tests/commands-missing.test.d.ts.map +0 -1
- package/tests/commands-missing.test.js +0 -470
- package/tests/commands-specific-units.test.d.ts +0 -2
- package/tests/commands-specific-units.test.d.ts.map +0 -1
- package/tests/commands-specific-units.test.js +0 -264
- package/tests/commands-text-sys.test.d.ts +0 -2
- package/tests/commands-text-sys.test.d.ts.map +0 -1
- package/tests/commands-text-sys.test.js +0 -366
- package/tests/expand.test.d.ts +0 -2
- package/tests/expand.test.d.ts.map +0 -1
- package/tests/expand.test.js +0 -138
- package/tests/helpers.test.d.ts +0 -2
- package/tests/helpers.test.d.ts.map +0 -1
- package/tests/helpers.test.js +0 -52
- package/tests/new-features.test.d.ts +0 -2
- package/tests/new-features.test.d.ts.map +0 -1
- package/tests/new-features.test.js +0 -850
- package/tests/parser-executor.test.d.ts +0 -2
- package/tests/parser-executor.test.d.ts.map +0 -1
- package/tests/parser-executor.test.js +0 -25
- package/tests/sftp.test.d.ts +0 -2
- package/tests/sftp.test.d.ts.map +0 -1
- package/tests/sftp.test.js +0 -246
- package/tests/ssh-exec.test.d.ts +0 -2
- package/tests/ssh-exec.test.d.ts.map +0 -1
- package/tests/ssh-exec.test.js +0 -39
- package/tests/test-helper.d.ts +0 -56
- package/tests/test-helper.d.ts.map +0 -1
- package/tests/test-helper.js +0 -71
- package/tests/users.test.d.ts +0 -2
- package/tests/users.test.d.ts.map +0 -1
- package/tests/users.test.js +0 -71
- package/tests/web.test.d.ts +0 -2
- package/tests/web.test.d.ts.map +0 -1
- package/tests/web.test.js +0 -149
- /package/{src → dist}/Honeypot/index.d.ts +0 -0
- /package/{src → dist}/SSHClient/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/exec.d.ts +0 -0
- /package/{src → dist}/SSHMimic/executor.d.ts +0 -0
- /package/{src → dist}/SSHMimic/hostKey.d.ts +0 -0
- /package/{src → dist}/SSHMimic/index.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginBanner.d.ts +0 -0
- /package/{src → dist}/SSHMimic/loginFormat.d.ts +0 -0
- /package/{src → dist}/SSHMimic/prompt.d.ts +0 -0
- /package/{src → dist}/SSHMimic/sftp.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/binaryPack.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/index.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/internalTypes.d.ts +0 -0
- /package/{src → dist}/VirtualFileSystem/path.d.ts +0 -0
- /package/{src → dist}/VirtualPackageManager/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/index.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shell.d.ts +0 -0
- /package/{src → dist}/VirtualShell/shellParser.d.ts +0 -0
- /package/{src → dist}/VirtualUserManager/index.d.ts +0 -0
- /package/{src → dist}/commands/adduser.d.ts +0 -0
- /package/{src → dist}/commands/alias.d.ts +0 -0
- /package/{src → dist}/commands/apt.d.ts +0 -0
- /package/{src → dist}/commands/awk.d.ts +0 -0
- /package/{src → dist}/commands/base64.d.ts +0 -0
- /package/{src → dist}/commands/cat.d.ts +0 -0
- /package/{src → dist}/commands/cd.d.ts +0 -0
- /package/{src → dist}/commands/chmod.d.ts +0 -0
- /package/{src → dist}/commands/clear.d.ts +0 -0
- /package/{src → dist}/commands/command-helpers.d.ts +0 -0
- /package/{src → dist}/commands/cp.d.ts +0 -0
- /package/{src → dist}/commands/curl.d.ts +0 -0
- /package/{src → dist}/commands/cut.d.ts +0 -0
- /package/{src → dist}/commands/date.d.ts +0 -0
- /package/{src → dist}/commands/declare.d.ts +0 -0
- /package/{src → dist}/commands/deluser.d.ts +0 -0
- /package/{src → dist}/commands/df.d.ts +0 -0
- /package/{src → dist}/commands/diff.d.ts +0 -0
- /package/{src → dist}/commands/dpkg.d.ts +0 -0
- /package/{src → dist}/commands/du.d.ts +0 -0
- /package/{src → dist}/commands/echo.d.ts +0 -0
- /package/{src → dist}/commands/env.d.ts +0 -0
- /package/{src → dist}/commands/exit.d.ts +0 -0
- /package/{src → dist}/commands/export.d.ts +0 -0
- /package/{src → dist}/commands/find.d.ts +0 -0
- /package/{src → dist}/commands/free.d.ts +0 -0
- /package/{src → dist}/commands/grep.d.ts +0 -0
- /package/{src → dist}/commands/groups.d.ts +0 -0
- /package/{src → dist}/commands/gzip.d.ts +0 -0
- /package/{src → dist}/commands/head.d.ts +0 -0
- /package/{src → dist}/commands/help.d.ts +0 -0
- /package/{src → dist}/commands/helpers.d.ts +0 -0
- /package/{src → dist}/commands/history.d.ts +0 -0
- /package/{src → dist}/commands/hostname.d.ts +0 -0
- /package/{src → dist}/commands/htop.d.ts +0 -0
- /package/{src → dist}/commands/id.d.ts +0 -0
- /package/{src → dist}/commands/index.d.ts +0 -0
- /package/{src → dist}/commands/kill.d.ts +0 -0
- /package/{src → dist}/commands/ln.d.ts +0 -0
- /package/{src → dist}/commands/ls.d.ts +0 -0
- /package/{src → dist}/commands/lsb-release.d.ts +0 -0
- /package/{src → dist}/commands/man.d.ts +0 -0
- /package/{src → dist}/commands/mkdir.d.ts +0 -0
- /package/{src → dist}/commands/mv.d.ts +0 -0
- /package/{src → dist}/commands/nano.d.ts +0 -0
- /package/{src → dist}/commands/neofetch.d.ts +0 -0
- /package/{src → dist}/commands/node.d.ts +0 -0
- /package/{src → dist}/commands/npm.d.ts +0 -0
- /package/{src → dist}/commands/passwd.d.ts +0 -0
- /package/{src → dist}/commands/ping.d.ts +0 -0
- /package/{src → dist}/commands/printf.d.ts +0 -0
- /package/{src → dist}/commands/ps.d.ts +0 -0
- /package/{src → dist}/commands/pwd.d.ts +0 -0
- /package/{src → dist}/commands/python.d.ts +0 -0
- /package/{src → dist}/commands/read.d.ts +0 -0
- /package/{src → dist}/commands/registry.d.ts +0 -0
- /package/{src → dist}/commands/rm.d.ts +0 -0
- /package/{src → dist}/commands/runtime.d.ts +0 -0
- /package/{src → dist}/commands/sed.d.ts +0 -0
- /package/{src → dist}/commands/seq.d.ts +0 -0
- /package/{src → dist}/commands/set.d.ts +0 -0
- /package/{src → dist}/commands/sh.d.ts +0 -0
- /package/{src → dist}/commands/shift.d.ts +0 -0
- /package/{src → dist}/commands/sleep.d.ts +0 -0
- /package/{src → dist}/commands/sort.d.ts +0 -0
- /package/{src → dist}/commands/source.d.ts +0 -0
- /package/{src → dist}/commands/stat.d.ts +0 -0
- /package/{src → dist}/commands/su.d.ts +0 -0
- /package/{src → dist}/commands/sudo.d.ts +0 -0
- /package/{src → dist}/commands/tail.d.ts +0 -0
- /package/{src → dist}/commands/tar.d.ts +0 -0
- /package/{src → dist}/commands/tee.d.ts +0 -0
- /package/{src → dist}/commands/test.d.ts +0 -0
- /package/{src → dist}/commands/touch.d.ts +0 -0
- /package/{src → dist}/commands/tr.d.ts +0 -0
- /package/{src → dist}/commands/tree.d.ts +0 -0
- /package/{src → dist}/commands/true.d.ts +0 -0
- /package/{src → dist}/commands/type.d.ts +0 -0
- /package/{src → dist}/commands/uname.d.ts +0 -0
- /package/{src → dist}/commands/uniq.d.ts +0 -0
- /package/{src → dist}/commands/unset.d.ts +0 -0
- /package/{src → dist}/commands/uptime.d.ts +0 -0
- /package/{src → dist}/commands/wc.d.ts +0 -0
- /package/{src → dist}/commands/wget.d.ts +0 -0
- /package/{src → dist}/commands/which.d.ts +0 -0
- /package/{src → dist}/commands/who.d.ts +0 -0
- /package/{src → dist}/commands/whoami.d.ts +0 -0
- /package/{src → dist}/commands/xargs.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/modules/linuxRootfs.d.ts +0 -0
- /package/{src → dist}/modules/neofetch.d.ts +0 -0
- /package/{src → dist}/modules/shellInteractive.d.ts +0 -0
- /package/{src → dist}/modules/shellRuntime.d.ts +0 -0
- /package/{src → dist}/self-standalone.d.ts +0 -0
- /package/{src → dist}/standalone-wo-sftp.d.ts +0 -0
- /package/{src → dist}/standalone.d.ts +0 -0
- /package/{src → dist}/types/commands.d.ts +0 -0
- /package/{src → dist}/types/pipeline.d.ts +0 -0
- /package/{src → dist}/types/streams.d.ts +0 -0
- /package/{src → dist}/types/vfs.d.ts +0 -0
- /package/{src → dist}/utils/expand.d.ts +0 -0
- /package/{src → dist}/utils/perfLogger.d.ts +0 -0
- /package/{src → dist}/utils/tokenize.d.ts +0 -0
- /package/{src → dist}/utils/vfsDiff.d.ts +0 -0
- /package/{src → dist}/web-api.d.ts +0 -0
- /package/{src → dist}/web-full.d.ts +0 -0
- /package/{src → dist}/web.d.ts +0 -0
|
@@ -1,477 +0,0 @@
|
|
|
1
|
-
import { beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
-
import { createTestEnv, createTestFile, pathExists, readTestFile, runCmd } from "./test-helper";
|
|
3
|
-
let shell;
|
|
4
|
-
let client;
|
|
5
|
-
beforeAll(async () => {
|
|
6
|
-
const env = await createTestEnv("test-core");
|
|
7
|
-
shell = env.shell;
|
|
8
|
-
client = env.client;
|
|
9
|
-
});
|
|
10
|
-
// ─── ECHO tests ───────────────────────────────────────────────────────────
|
|
11
|
-
describe("echo command", () => {
|
|
12
|
-
test("echo basic output", async () => {
|
|
13
|
-
const r = await runCmd(client, "echo hello");
|
|
14
|
-
expect(r.exitCode).toBe(0);
|
|
15
|
-
expect(r.stdout?.trim()).toBe("hello");
|
|
16
|
-
});
|
|
17
|
-
test("echo multiple args", async () => {
|
|
18
|
-
const r = await runCmd(client, "echo hello world");
|
|
19
|
-
expect(r.exitCode).toBe(0);
|
|
20
|
-
expect(r.stdout?.trim()).toBe("hello world");
|
|
21
|
-
});
|
|
22
|
-
test("echo with -n flag (no newline)", async () => {
|
|
23
|
-
const r = await runCmd(client, "echo -n hello");
|
|
24
|
-
expect(r.exitCode).toBe(0);
|
|
25
|
-
expect(r.stdout).toBe("hello");
|
|
26
|
-
expect(r.stdout?.endsWith("\n")).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
test("echo with -e flag (escape sequences)", async () => {
|
|
29
|
-
const r = await runCmd(client, "echo -e 'hello\\nworld'");
|
|
30
|
-
expect(r.exitCode).toBe(0);
|
|
31
|
-
expect(r.stdout).toContain("hello");
|
|
32
|
-
expect(r.stdout).toContain("world");
|
|
33
|
-
});
|
|
34
|
-
test("echo with -e and tab", async () => {
|
|
35
|
-
const r = await runCmd(client, "echo -e 'col1\\tcol2'");
|
|
36
|
-
expect(r.exitCode).toBe(0);
|
|
37
|
-
expect(r.stdout).toContain("\t");
|
|
38
|
-
});
|
|
39
|
-
test("echo with empty string", async () => {
|
|
40
|
-
const r = await runCmd(client, "echo ''");
|
|
41
|
-
expect(r.exitCode).toBe(0);
|
|
42
|
-
expect(r.stdout?.trim()).toBe("");
|
|
43
|
-
});
|
|
44
|
-
test("echo with special chars", async () => {
|
|
45
|
-
const r = await runCmd(client, "echo 'test@#$%'");
|
|
46
|
-
expect(r.exitCode).toBe(0);
|
|
47
|
-
expect(r.stdout).toContain("test@#$%");
|
|
48
|
-
});
|
|
49
|
-
test("echo with variables", async () => {
|
|
50
|
-
const r = await runCmd(client, "echo $HOME");
|
|
51
|
-
expect(r.exitCode).toBe(0);
|
|
52
|
-
expect(r.stdout?.trim()).toMatch(/home|root/);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
// ─── PWD tests ────────────────────────────────────────────────────────────
|
|
56
|
-
describe("pwd command", () => {
|
|
57
|
-
test("pwd returns current directory", async () => {
|
|
58
|
-
const r = await runCmd(client, "pwd");
|
|
59
|
-
expect(r.exitCode).toBe(0);
|
|
60
|
-
expect(r.stdout?.trim()).toBeDefined();
|
|
61
|
-
expect(r.stdout?.trim().length).toBeGreaterThan(0);
|
|
62
|
-
});
|
|
63
|
-
test("pwd after cd", async () => {
|
|
64
|
-
await runCmd(client, "cd /tmp");
|
|
65
|
-
const r = await runCmd(client, "pwd");
|
|
66
|
-
expect(r.exitCode).toBe(0);
|
|
67
|
-
expect(r.stdout?.trim()).toBe("/tmp");
|
|
68
|
-
await runCmd(client, "cd /root");
|
|
69
|
-
});
|
|
70
|
-
test("pwd with no args", async () => {
|
|
71
|
-
const r = await runCmd(client, "pwd");
|
|
72
|
-
expect(r.exitCode).toBe(0);
|
|
73
|
-
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
// ─── CAT tests ────────────────────────────────────────────────────────────
|
|
77
|
-
describe("cat command", () => {
|
|
78
|
-
test("cat single file", async () => {
|
|
79
|
-
createTestFile(shell, "/tmp/test.txt", "hello world");
|
|
80
|
-
const r = await runCmd(client, "cat /tmp/test.txt");
|
|
81
|
-
expect(r.exitCode).toBe(0);
|
|
82
|
-
expect(r.stdout?.trim()).toBe("hello world");
|
|
83
|
-
});
|
|
84
|
-
test("cat multiple files", async () => {
|
|
85
|
-
createTestFile(shell, "/tmp/file1.txt", "file1");
|
|
86
|
-
createTestFile(shell, "/tmp/file2.txt", "file2");
|
|
87
|
-
const r = await runCmd(client, "cat /tmp/file1.txt /tmp/file2.txt");
|
|
88
|
-
expect(r.exitCode).toBe(0);
|
|
89
|
-
expect(r.stdout).toContain("file1");
|
|
90
|
-
expect(r.stdout).toContain("file2");
|
|
91
|
-
});
|
|
92
|
-
test("cat with -n flag (line numbers)", async () => {
|
|
93
|
-
createTestFile(shell, "/tmp/numbered.txt", "line1\nline2\nline3");
|
|
94
|
-
const r = await runCmd(client, "cat -n /tmp/numbered.txt");
|
|
95
|
-
expect(r.exitCode).toBe(0);
|
|
96
|
-
expect(r.stdout).toContain("1");
|
|
97
|
-
expect(r.stdout).toContain("2");
|
|
98
|
-
expect(r.stdout).toContain("3");
|
|
99
|
-
});
|
|
100
|
-
test("cat with -b flag (number non-blank)", async () => {
|
|
101
|
-
createTestFile(shell, "/tmp/blank.txt", "line1\n\nline2");
|
|
102
|
-
const r = await runCmd(client, "cat -b /tmp/blank.txt");
|
|
103
|
-
expect(r.exitCode).toBe(0);
|
|
104
|
-
expect(r.stdout).toContain("line1");
|
|
105
|
-
expect(r.stdout).toContain("line2");
|
|
106
|
-
});
|
|
107
|
-
test("cat non-existent file", async () => {
|
|
108
|
-
const r = await runCmd(client, "cat /tmp/nonexistent.txt");
|
|
109
|
-
expect(r.exitCode).not.toBe(0);
|
|
110
|
-
expect(r.stderr).toBeDefined();
|
|
111
|
-
});
|
|
112
|
-
test("cat with stdin", async () => {
|
|
113
|
-
const r = await runCmd(client, "echo 'test' | cat");
|
|
114
|
-
expect(r.exitCode).toBe(0);
|
|
115
|
-
expect(r.stdout?.trim()).toBe("test");
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
// ─── LS tests ──────────────────────────────────────────────────────────────
|
|
119
|
-
describe("ls command", () => {
|
|
120
|
-
test("ls lists directory", async () => {
|
|
121
|
-
createTestFile(shell, "/tmp/ls-test1.txt", "content");
|
|
122
|
-
const r = await runCmd(client, "ls /tmp");
|
|
123
|
-
expect(r.exitCode).toBe(0);
|
|
124
|
-
expect(r.stdout).toContain("ls-test1.txt");
|
|
125
|
-
});
|
|
126
|
-
test("ls with -l flag (long format)", async () => {
|
|
127
|
-
createTestFile(shell, "/tmp/ls-long.txt", "test");
|
|
128
|
-
const r = await runCmd(client, "ls -l /tmp");
|
|
129
|
-
expect(r.exitCode).toBe(0);
|
|
130
|
-
expect(r.stdout).toContain("-rw");
|
|
131
|
-
});
|
|
132
|
-
test("ls current directory", async () => {
|
|
133
|
-
const r = await runCmd(client, "ls /root");
|
|
134
|
-
expect(r.exitCode).toBe(0);
|
|
135
|
-
expect(r.stdout?.length).toBeGreaterThanOrEqual(0);
|
|
136
|
-
});
|
|
137
|
-
test("ls with -a flag (show hidden)", async () => {
|
|
138
|
-
const r = await runCmd(client, "ls -a /root");
|
|
139
|
-
expect(r.exitCode).toBe(0);
|
|
140
|
-
expect(r.stdout?.length).toBeGreaterThanOrEqual(0);
|
|
141
|
-
});
|
|
142
|
-
test("ls with -h flag (human readable)", async () => {
|
|
143
|
-
createTestFile(shell, "/tmp/ls-human.txt", "a".repeat(1024));
|
|
144
|
-
const r = await runCmd(client, "ls -lh /tmp/ls-human.txt");
|
|
145
|
-
expect(r.exitCode).toBe(0);
|
|
146
|
-
expect(r.stdout).toContain("ls-human.txt");
|
|
147
|
-
});
|
|
148
|
-
test("ls non-existent path", async () => {
|
|
149
|
-
const r = await runCmd(client, "ls /nonexistent");
|
|
150
|
-
expect(r.exitCode).not.toBe(0);
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
// ─── MKDIR/RMDIR tests ────────────────────────────────────────────────────
|
|
154
|
-
describe("mkdir command", () => {
|
|
155
|
-
test("mkdir creates directory", async () => {
|
|
156
|
-
const r = await runCmd(client, "mkdir /tmp/testdir");
|
|
157
|
-
expect(r.exitCode).toBe(0);
|
|
158
|
-
expect(pathExists(shell, "/tmp/testdir")).toBe(true);
|
|
159
|
-
});
|
|
160
|
-
test("mkdir -p creates nested dirs", async () => {
|
|
161
|
-
const r = await runCmd(client, "mkdir -p /tmp/a/b/c");
|
|
162
|
-
expect(r.exitCode).toBe(0);
|
|
163
|
-
expect(pathExists(shell, "/tmp/a/b/c")).toBe(true);
|
|
164
|
-
});
|
|
165
|
-
test("mkdir duplicate dir fails", async () => {
|
|
166
|
-
await runCmd(client, "mkdir /tmp/dup-unique");
|
|
167
|
-
const r = await runCmd(client, "mkdir /tmp/dup-unique 2>&1 || echo 'error'");
|
|
168
|
-
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
// ─── TOUCH tests ───────────────────────────────────────────────────────────
|
|
172
|
-
describe("touch command", () => {
|
|
173
|
-
test("touch creates file", async () => {
|
|
174
|
-
const r = await runCmd(client, "touch /tmp/newfile.txt");
|
|
175
|
-
expect(r.exitCode).toBe(0);
|
|
176
|
-
expect(pathExists(shell, "/tmp/newfile.txt")).toBe(true);
|
|
177
|
-
});
|
|
178
|
-
test("touch updates timestamp on existing file", async () => {
|
|
179
|
-
createTestFile(shell, "/tmp/existing.txt", "content");
|
|
180
|
-
const r = await runCmd(client, "touch /tmp/existing.txt");
|
|
181
|
-
expect(r.exitCode).toBe(0);
|
|
182
|
-
expect(pathExists(shell, "/tmp/existing.txt")).toBe(true);
|
|
183
|
-
});
|
|
184
|
-
test("touch multiple files", async () => {
|
|
185
|
-
const r = await runCmd(client, "touch /tmp/file1.txt /tmp/file2.txt");
|
|
186
|
-
expect(r.exitCode).toBe(0);
|
|
187
|
-
expect(pathExists(shell, "/tmp/file1.txt")).toBe(true);
|
|
188
|
-
expect(pathExists(shell, "/tmp/file2.txt")).toBe(true);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
// ─── RM tests ──────────────────────────────────────────────────────────────
|
|
192
|
-
describe("rm command", () => {
|
|
193
|
-
test("rm deletes file", async () => {
|
|
194
|
-
createTestFile(shell, "/tmp/todel.txt", "content");
|
|
195
|
-
const r = await runCmd(client, "rm /tmp/todel.txt");
|
|
196
|
-
expect(r.exitCode).toBe(0);
|
|
197
|
-
expect(pathExists(shell, "/tmp/todel.txt")).toBe(false);
|
|
198
|
-
});
|
|
199
|
-
test("rm non-existent file fails", async () => {
|
|
200
|
-
const r = await runCmd(client, "rm /tmp/doesnotexist.txt");
|
|
201
|
-
expect(r.exitCode).not.toBe(0);
|
|
202
|
-
});
|
|
203
|
-
test("rm -r deletes directory recursively", async () => {
|
|
204
|
-
await runCmd(client, "mkdir -p /tmp/rmdir/sub");
|
|
205
|
-
createTestFile(shell, "/tmp/rmdir/sub/file.txt", "test");
|
|
206
|
-
const r = await runCmd(client, "rm -r /tmp/rmdir");
|
|
207
|
-
expect(r.exitCode).toBe(0);
|
|
208
|
-
expect(pathExists(shell, "/tmp/rmdir")).toBe(false);
|
|
209
|
-
});
|
|
210
|
-
test("rm multiple files", async () => {
|
|
211
|
-
createTestFile(shell, "/tmp/rm1.txt", "1");
|
|
212
|
-
createTestFile(shell, "/tmp/rm2.txt", "2");
|
|
213
|
-
const r = await runCmd(client, "rm /tmp/rm1.txt /tmp/rm2.txt");
|
|
214
|
-
expect(r.exitCode).toBe(0);
|
|
215
|
-
expect(pathExists(shell, "/tmp/rm1.txt")).toBe(false);
|
|
216
|
-
expect(pathExists(shell, "/tmp/rm2.txt")).toBe(false);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
// ─── CP tests ──────────────────────────────────────────────────────────────
|
|
220
|
-
describe("cp command", () => {
|
|
221
|
-
test("cp copies file", async () => {
|
|
222
|
-
createTestFile(shell, "/tmp/original.txt", "content");
|
|
223
|
-
const r = await runCmd(client, "cp /tmp/original.txt /tmp/copy.txt");
|
|
224
|
-
expect(r.exitCode).toBe(0);
|
|
225
|
-
expect(pathExists(shell, "/tmp/copy.txt")).toBe(true);
|
|
226
|
-
expect(readTestFile(shell, "/tmp/copy.txt")).toBe("content");
|
|
227
|
-
});
|
|
228
|
-
test("cp to different name", async () => {
|
|
229
|
-
createTestFile(shell, "/tmp/src.txt", "data");
|
|
230
|
-
const r = await runCmd(client, "cp /tmp/src.txt /tmp/dst.txt");
|
|
231
|
-
expect(r.exitCode).toBe(0);
|
|
232
|
-
expect(readTestFile(shell, "/tmp/dst.txt")).toBe("data");
|
|
233
|
-
});
|
|
234
|
-
test("cp -r copies directory recursively", async () => {
|
|
235
|
-
await runCmd(client, "mkdir -p /tmp/srcdir/sub");
|
|
236
|
-
createTestFile(shell, "/tmp/srcdir/file.txt", "test");
|
|
237
|
-
createTestFile(shell, "/tmp/srcdir/sub/file2.txt", "test2");
|
|
238
|
-
const r = await runCmd(client, "cp -r /tmp/srcdir /tmp/dstdir");
|
|
239
|
-
expect(r.exitCode).toBe(0);
|
|
240
|
-
expect(pathExists(shell, "/tmp/dstdir/file.txt")).toBe(true);
|
|
241
|
-
expect(pathExists(shell, "/tmp/dstdir/sub/file2.txt")).toBe(true);
|
|
242
|
-
});
|
|
243
|
-
test("cp to directory", async () => {
|
|
244
|
-
createTestFile(shell, "/tmp/cpfile.txt", "content");
|
|
245
|
-
await runCmd(client, "mkdir -p /tmp/cpdir");
|
|
246
|
-
const r = await runCmd(client, "cp /tmp/cpfile.txt /tmp/cpdir/");
|
|
247
|
-
expect(r.exitCode).toBe(0);
|
|
248
|
-
expect(pathExists(shell, "/tmp/cpdir/cpfile.txt")).toBe(true);
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
// ─── MV tests ──────────────────────────────────────────────────────────────
|
|
252
|
-
describe("mv command", () => {
|
|
253
|
-
test("mv moves file", async () => {
|
|
254
|
-
createTestFile(shell, "/tmp/mvold.txt", "content");
|
|
255
|
-
const r = await runCmd(client, "mv /tmp/mvold.txt /tmp/mvnew.txt");
|
|
256
|
-
expect(r.exitCode).toBe(0);
|
|
257
|
-
expect(pathExists(shell, "/tmp/mvold.txt")).toBe(false);
|
|
258
|
-
expect(pathExists(shell, "/tmp/mvnew.txt")).toBe(true);
|
|
259
|
-
});
|
|
260
|
-
test("mv renames file", async () => {
|
|
261
|
-
createTestFile(shell, "/tmp/oldname.txt", "data");
|
|
262
|
-
const r = await runCmd(client, "mv /tmp/oldname.txt /tmp/newname.txt");
|
|
263
|
-
expect(r.exitCode).toBe(0);
|
|
264
|
-
expect(readTestFile(shell, "/tmp/newname.txt")).toBe("data");
|
|
265
|
-
});
|
|
266
|
-
test("mv to directory", async () => {
|
|
267
|
-
createTestFile(shell, "/tmp/mvfile.txt", "test");
|
|
268
|
-
await runCmd(client, "mkdir -p /tmp/mvdest");
|
|
269
|
-
const r = await runCmd(client, "mv /tmp/mvfile.txt /tmp/mvdest/");
|
|
270
|
-
expect(r.exitCode).toBe(0);
|
|
271
|
-
expect(pathExists(shell, "/tmp/mvdest/mvfile.txt")).toBe(true);
|
|
272
|
-
});
|
|
273
|
-
test("mv non-existent file fails", async () => {
|
|
274
|
-
const r = await runCmd(client, "mv /tmp/nonexist.txt /tmp/dest.txt");
|
|
275
|
-
expect(r.exitCode).not.toBe(0);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
// ─── CHMOD tests ──────────────────────────────────────────────────────────
|
|
279
|
-
describe("chmod command", () => {
|
|
280
|
-
test("chmod changes permissions", async () => {
|
|
281
|
-
createTestFile(shell, "/tmp/chmodfile.txt", "test");
|
|
282
|
-
const r = await runCmd(client, "chmod 644 /tmp/chmodfile.txt");
|
|
283
|
-
expect(r.exitCode).toBe(0);
|
|
284
|
-
});
|
|
285
|
-
test("chmod recursive", async () => {
|
|
286
|
-
await runCmd(client, "mkdir -p /tmp/chmoddir2/sub");
|
|
287
|
-
createTestFile(shell, "/tmp/chmoddir2/file.txt", "test");
|
|
288
|
-
const r = await runCmd(client, "chmod -R 755 /tmp/chmoddir2");
|
|
289
|
-
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
290
|
-
});
|
|
291
|
-
test("chmod with symbolic notation", async () => {
|
|
292
|
-
createTestFile(shell, "/tmp/symbolic.txt", "test");
|
|
293
|
-
const r = await runCmd(client, "chmod u+x /tmp/symbolic.txt");
|
|
294
|
-
expect(r.exitCode).toBe(0);
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
// ─── GREP tests ───────────────────────────────────────────────────────────
|
|
298
|
-
describe("grep command", () => {
|
|
299
|
-
test("grep finds pattern", async () => {
|
|
300
|
-
createTestFile(shell, "/tmp/greptarget.txt", "hello\nworld\nhello world");
|
|
301
|
-
const r = await runCmd(client, "grep hello /tmp/greptarget.txt");
|
|
302
|
-
expect(r.exitCode).toBe(0);
|
|
303
|
-
expect(r.stdout).toContain("hello");
|
|
304
|
-
});
|
|
305
|
-
test("grep -i case insensitive", async () => {
|
|
306
|
-
createTestFile(shell, "/tmp/grep-case.txt", "HELLO\nhello\nHello");
|
|
307
|
-
const r = await runCmd(client, "grep -i hello /tmp/grep-case.txt");
|
|
308
|
-
expect(r.exitCode).toBe(0);
|
|
309
|
-
expect(r.stdout?.split("\n").filter((l) => l).length).toBeGreaterThanOrEqual(3);
|
|
310
|
-
});
|
|
311
|
-
test("grep -v inverts match", async () => {
|
|
312
|
-
createTestFile(shell, "/tmp/grep-not.txt", "apple\norange\nbanana");
|
|
313
|
-
const r = await runCmd(client, "grep -v apple /tmp/grep-not.txt");
|
|
314
|
-
expect(r.exitCode).toBe(0);
|
|
315
|
-
expect(r.stdout).not.toContain("apple");
|
|
316
|
-
expect(r.stdout).toContain("orange");
|
|
317
|
-
});
|
|
318
|
-
test("grep from pipe", async () => {
|
|
319
|
-
const r = await runCmd(client, "echo -e 'foo\\nbar\\nfoo' | grep foo");
|
|
320
|
-
expect(r.exitCode).toBe(0);
|
|
321
|
-
expect(r.stdout?.split("\n").filter((l) => l).length).toBe(2);
|
|
322
|
-
});
|
|
323
|
-
test("grep no match returns non-zero", async () => {
|
|
324
|
-
createTestFile(shell, "/tmp/grep-nomatch.txt", "content");
|
|
325
|
-
const r = await runCmd(client, "grep nomatch /tmp/grep-nomatch.txt");
|
|
326
|
-
expect(r.exitCode).not.toBe(0);
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
// ─── HEAD tests ───────────────────────────────────────────────────────────
|
|
330
|
-
describe("head command", () => {
|
|
331
|
-
test("head default 10 lines", async () => {
|
|
332
|
-
let content = "";
|
|
333
|
-
for (let i = 1; i <= 20; i++) {
|
|
334
|
-
content += `line${i}\n`;
|
|
335
|
-
}
|
|
336
|
-
createTestFile(shell, "/tmp/head-test.txt", content);
|
|
337
|
-
const r = await runCmd(client, "head /tmp/head-test.txt");
|
|
338
|
-
expect(r.exitCode).toBe(0);
|
|
339
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
340
|
-
expect(lines?.length).toBe(10);
|
|
341
|
-
expect(r.stdout).toContain("line1");
|
|
342
|
-
expect(r.stdout).not.toContain("line11");
|
|
343
|
-
});
|
|
344
|
-
test("head -n custom lines", async () => {
|
|
345
|
-
let content = "";
|
|
346
|
-
for (let i = 1; i <= 20; i++) {
|
|
347
|
-
content += `line${i}\n`;
|
|
348
|
-
}
|
|
349
|
-
createTestFile(shell, "/tmp/head-custom.txt", content);
|
|
350
|
-
const r = await runCmd(client, "head -n 5 /tmp/head-custom.txt");
|
|
351
|
-
expect(r.exitCode).toBe(0);
|
|
352
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
353
|
-
expect(lines?.length).toBe(5);
|
|
354
|
-
});
|
|
355
|
-
test("head from pipe", async () => {
|
|
356
|
-
const r = await runCmd(client, "seq 1 20 | head -n 5");
|
|
357
|
-
expect(r.exitCode).toBe(0);
|
|
358
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
359
|
-
expect(lines?.length).toBe(5);
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
// ─── TAIL tests ───────────────────────────────────────────────────────────
|
|
363
|
-
describe("tail command", () => {
|
|
364
|
-
test("tail default 10 lines", async () => {
|
|
365
|
-
let content = "";
|
|
366
|
-
for (let i = 1; i <= 20; i++) {
|
|
367
|
-
content += `line${i}\n`;
|
|
368
|
-
}
|
|
369
|
-
createTestFile(shell, "/tmp/tail-test2.txt", content);
|
|
370
|
-
const r = await runCmd(client, "tail /tmp/tail-test2.txt");
|
|
371
|
-
expect(r.exitCode).toBe(0);
|
|
372
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
373
|
-
expect(lines?.length).toBeGreaterThanOrEqual(8);
|
|
374
|
-
expect(r.stdout).toContain("line20");
|
|
375
|
-
});
|
|
376
|
-
test("tail -n custom lines", async () => {
|
|
377
|
-
let content = "";
|
|
378
|
-
for (let i = 1; i <= 20; i++) {
|
|
379
|
-
content += `line${i}\n`;
|
|
380
|
-
}
|
|
381
|
-
createTestFile(shell, "/tmp/tail-custom.txt", content);
|
|
382
|
-
const r = await runCmd(client, "tail -n 5 /tmp/tail-custom.txt");
|
|
383
|
-
expect(r.exitCode).toBe(0);
|
|
384
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
385
|
-
expect(lines?.length).toBe(5);
|
|
386
|
-
expect(r.stdout).toContain("line16");
|
|
387
|
-
});
|
|
388
|
-
test("tail from pipe", async () => {
|
|
389
|
-
const r = await runCmd(client, "seq 1 20 | tail -n 5");
|
|
390
|
-
expect(r.exitCode).toBe(0);
|
|
391
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
392
|
-
expect(lines?.length).toBe(5);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
// ─── WC tests ──────────────────────────────────────────────────────────────
|
|
396
|
-
describe("wc command", () => {
|
|
397
|
-
test("wc counts lines", async () => {
|
|
398
|
-
createTestFile(shell, "/tmp/wc-test.txt", "line1\nline2\nline3");
|
|
399
|
-
const r = await runCmd(client, "wc -l /tmp/wc-test.txt");
|
|
400
|
-
expect(r.exitCode).toBe(0);
|
|
401
|
-
expect(r.stdout?.trim()).toContain("3 /tmp/wc-test.txt");
|
|
402
|
-
});
|
|
403
|
-
test("wc counts words", async () => {
|
|
404
|
-
createTestFile(shell, "/tmp/wc-words.txt", "one two three");
|
|
405
|
-
const r = await runCmd(client, "wc -w /tmp/wc-words.txt");
|
|
406
|
-
expect(r.exitCode).toBe(0);
|
|
407
|
-
expect(r.stdout?.trim()).toContain("3 /tmp/wc-words.txt");
|
|
408
|
-
});
|
|
409
|
-
test("wc counts chars", async () => {
|
|
410
|
-
createTestFile(shell, "/tmp/wc-chars.txt", "hello");
|
|
411
|
-
const r = await runCmd(client, "wc -c /tmp/wc-chars.txt");
|
|
412
|
-
expect(r.exitCode).toBe(0);
|
|
413
|
-
expect(r.stdout?.trim()).toContain("5 /tmp/wc-chars.txt");
|
|
414
|
-
});
|
|
415
|
-
test("wc default (lines words chars)", async () => {
|
|
416
|
-
createTestFile(shell, "/tmp/wc-all.txt", "hello world\ntest");
|
|
417
|
-
const r = await runCmd(client, "wc /tmp/wc-all.txt");
|
|
418
|
-
expect(r.exitCode).toBe(0);
|
|
419
|
-
expect(r.stdout?.trim()).toContain("2");
|
|
420
|
-
expect(r.stdout?.trim()).toContain("3");
|
|
421
|
-
expect(r.stdout?.trim()).toContain("/tmp/wc-all.txt");
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
// ─── SORT tests ───────────────────────────────────────────────────────────
|
|
425
|
-
describe("sort command", () => {
|
|
426
|
-
test("sort lines alphabetically", async () => {
|
|
427
|
-
createTestFile(shell, "/tmp/sort-test.txt", "zebra\napple\nmango\nbanana");
|
|
428
|
-
const r = await runCmd(client, "sort /tmp/sort-test.txt");
|
|
429
|
-
expect(r.exitCode).toBe(0);
|
|
430
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
431
|
-
expect(lines?.[0]).toBe("apple");
|
|
432
|
-
expect(lines?.[1]).toBe("banana");
|
|
433
|
-
expect(lines?.[3]).toBe("zebra");
|
|
434
|
-
});
|
|
435
|
-
test("sort -r reverse", async () => {
|
|
436
|
-
createTestFile(shell, "/tmp/sort-rev.txt", "a\nb\nc");
|
|
437
|
-
const r = await runCmd(client, "sort -r /tmp/sort-rev.txt");
|
|
438
|
-
expect(r.exitCode).toBe(0);
|
|
439
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
440
|
-
expect(lines?.[0]).toBe("c");
|
|
441
|
-
expect(lines?.[2]).toBe("a");
|
|
442
|
-
});
|
|
443
|
-
test("sort -n numeric", async () => {
|
|
444
|
-
createTestFile(shell, "/tmp/sort-num.txt", "10\n2\n1\n100");
|
|
445
|
-
const r = await runCmd(client, "sort -n /tmp/sort-num.txt");
|
|
446
|
-
expect(r.exitCode).toBe(0);
|
|
447
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
448
|
-
expect(lines?.[0]).toBe("1");
|
|
449
|
-
expect(lines?.[1]).toBe("2");
|
|
450
|
-
});
|
|
451
|
-
test("sort from pipe", async () => {
|
|
452
|
-
const r = await runCmd(client, "echo -e 'c\\na\\nb' | sort");
|
|
453
|
-
expect(r.exitCode).toBe(0);
|
|
454
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
455
|
-
expect(lines?.[0]).toBe("a");
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
// ─── UNIQ tests ───────────────────────────────────────────────────────────
|
|
459
|
-
describe("uniq command", () => {
|
|
460
|
-
test("uniq removes consecutive duplicates", async () => {
|
|
461
|
-
createTestFile(shell, "/tmp/uniq-test3.txt", "apple\napple\nbanana\nbanana\napple");
|
|
462
|
-
const r = await runCmd(client, "uniq /tmp/uniq-test3.txt || echo 'uniq'");
|
|
463
|
-
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
464
|
-
});
|
|
465
|
-
test("uniq -c count occurrences", async () => {
|
|
466
|
-
createTestFile(shell, "/tmp/uniq-count2.txt", "a\na\na\nb\nb");
|
|
467
|
-
const r = await runCmd(client, "uniq -c /tmp/uniq-count2.txt");
|
|
468
|
-
expect(r.exitCode).toBe(0);
|
|
469
|
-
expect(r.stdout?.trim().length).toBeGreaterThan(0);
|
|
470
|
-
});
|
|
471
|
-
test("uniq from pipe", async () => {
|
|
472
|
-
const r = await runCmd(client, "echo -e 'x\\nx\\ny\\ny' | uniq");
|
|
473
|
-
expect(r.exitCode).toBe(0);
|
|
474
|
-
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
475
|
-
expect(lines?.length).toBe(2);
|
|
476
|
-
});
|
|
477
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands-missing.test.d.ts","sourceRoot":"","sources":["commands-missing.test.ts"],"names":[],"mappings":""}
|