typescript-virtual-container 1.4.3 → 1.4.4
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/.vscode/settings.json +2 -1
- package/README.md +137 -19
- package/benchmark-results.txt +21 -21
- package/builds/self-standalone.js +200 -193
- package/builds/self-standalone.js.map +4 -4
- package/builds/standalone-wo-sftp.js +166 -159
- package/builds/standalone-wo-sftp.js.map +4 -4
- package/builds/standalone.js +168 -161
- 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 +4 -6
- package/examples/web.min.js +5 -5
- package/package.json +4 -3
- package/src/Honeypot/index.d.ts.map +1 -0
- package/src/SSHClient/index.d.ts.map +1 -0
- package/src/SSHMimic/exec.d.ts.map +1 -0
- package/src/SSHMimic/executor.d.ts.map +1 -0
- package/src/SSHMimic/hostKey.d.ts.map +1 -0
- package/src/SSHMimic/index.d.ts.map +1 -0
- package/src/SSHMimic/loginBanner.d.ts.map +1 -0
- package/src/SSHMimic/loginFormat.d.ts.map +1 -0
- package/src/SSHMimic/prompt.d.ts.map +1 -0
- package/src/SSHMimic/sftp.d.ts.map +1 -0
- package/src/VirtualFileSystem/binaryPack.d.ts.map +1 -0
- package/src/VirtualFileSystem/index.d.ts.map +1 -0
- package/src/VirtualFileSystem/index.ts +11 -9
- package/src/VirtualFileSystem/internalTypes.d.ts.map +1 -0
- package/src/VirtualFileSystem/path.d.ts.map +1 -0
- package/src/VirtualPackageManager/index.d.ts.map +1 -0
- package/src/VirtualShell/index.d.ts.map +1 -0
- package/src/VirtualShell/shell.d.ts.map +1 -0
- package/src/VirtualShell/shellParser.d.ts.map +1 -0
- package/{dist → src}/VirtualShell/shellParser.js +2 -1
- package/src/VirtualShell/shellParser.ts +3 -2
- package/src/VirtualUserManager/index.d.ts.map +1 -0
- package/src/bun.d.ts +1 -0
- package/src/commands/adduser.d.ts.map +1 -0
- package/src/commands/alias.d.ts.map +1 -0
- package/src/commands/apt.d.ts.map +1 -0
- package/src/commands/awk.d.ts.map +1 -0
- package/{dist → src}/commands/awk.js +1 -2
- package/src/commands/awk.ts +1 -2
- package/src/commands/base64.d.ts.map +1 -0
- package/src/commands/cat.d.ts.map +1 -0
- package/src/commands/cd.d.ts.map +1 -0
- package/{dist → src}/commands/cd.js +2 -2
- package/src/commands/cd.ts +2 -2
- package/src/commands/chmod.d.ts.map +1 -0
- package/src/commands/clear.d.ts.map +1 -0
- package/src/commands/command-helpers.d.ts.map +1 -0
- package/src/commands/cp.d.ts.map +1 -0
- package/src/commands/curl.d.ts.map +1 -0
- package/src/commands/cut.d.ts.map +1 -0
- package/src/commands/date.d.ts.map +1 -0
- package/src/commands/declare.d.ts.map +1 -0
- package/src/commands/deluser.d.ts.map +1 -0
- package/src/commands/df.d.ts.map +1 -0
- package/src/commands/diff.d.ts.map +1 -0
- package/src/commands/dpkg.d.ts.map +1 -0
- package/src/commands/du.d.ts.map +1 -0
- package/src/commands/echo.d.ts.map +1 -0
- package/src/commands/env.d.ts.map +1 -0
- package/src/commands/exit.d.ts.map +1 -0
- package/src/commands/export.d.ts.map +1 -0
- package/src/commands/find.d.ts.map +1 -0
- package/src/commands/free.d.ts.map +1 -0
- package/src/commands/grep.d.ts.map +1 -0
- package/src/commands/groups.d.ts.map +1 -0
- package/src/commands/gzip.d.ts.map +1 -0
- package/src/commands/head.d.ts.map +1 -0
- package/src/commands/help.d.ts.map +1 -0
- package/src/commands/helpers.d.ts.map +1 -0
- package/{dist → src}/commands/helpers.js +3 -0
- package/src/commands/helpers.ts +3 -0
- package/src/commands/history.d.ts.map +1 -0
- package/src/commands/hostname.d.ts.map +1 -0
- package/src/commands/htop.d.ts.map +1 -0
- package/src/commands/id.d.ts.map +1 -0
- package/src/commands/index.d.ts.map +1 -0
- package/src/commands/kill.d.ts.map +1 -0
- package/src/commands/ln.d.ts.map +1 -0
- package/src/commands/ls.d.ts.map +1 -0
- package/src/commands/ls.js +200 -0
- package/src/commands/ls.ts +210 -41
- package/src/commands/lsb-release.d.ts.map +1 -0
- package/src/commands/man.d.ts.map +1 -0
- package/src/commands/mkdir.d.ts.map +1 -0
- package/src/commands/mv.d.ts.map +1 -0
- package/src/commands/nano.d.ts.map +1 -0
- package/src/commands/neofetch.d.ts.map +1 -0
- package/src/commands/node.d.ts.map +1 -0
- package/src/commands/npm.d.ts.map +1 -0
- package/src/commands/passwd.d.ts.map +1 -0
- package/src/commands/ping.d.ts.map +1 -0
- package/src/commands/printf.d.ts.map +1 -0
- package/src/commands/ps.d.ts.map +1 -0
- package/src/commands/pwd.d.ts.map +1 -0
- package/src/commands/python.d.ts.map +1 -0
- package/src/commands/read.d.ts.map +1 -0
- package/src/commands/registry.d.ts.map +1 -0
- package/src/commands/rm.d.ts.map +1 -0
- package/src/commands/runtime.d.ts.map +1 -0
- package/{dist → src}/commands/runtime.js +36 -0
- package/src/commands/runtime.ts +56 -3
- package/src/commands/sed.d.ts.map +1 -0
- package/src/commands/seq.d.ts.map +1 -0
- package/src/commands/set.d.ts.map +1 -0
- package/src/commands/sh.d.ts.map +1 -0
- package/{dist → src}/commands/sh.js +8 -4
- package/src/commands/sh.ts +7 -4
- package/src/commands/shift.d.ts.map +1 -0
- package/src/commands/sleep.d.ts.map +1 -0
- package/src/commands/sort.d.ts.map +1 -0
- package/src/commands/source.d.ts.map +1 -0
- package/src/commands/stat.d.ts.map +1 -0
- package/src/commands/su.d.ts.map +1 -0
- package/src/commands/sudo.d.ts.map +1 -0
- package/src/commands/tail.d.ts.map +1 -0
- package/src/commands/tar.d.ts.map +1 -0
- package/src/commands/tee.d.ts.map +1 -0
- package/src/commands/test.d.ts.map +1 -0
- package/src/commands/test.ts +4 -2
- package/src/commands/touch.d.ts.map +1 -0
- package/src/commands/tr.d.ts.map +1 -0
- package/src/commands/tree.d.ts.map +1 -0
- package/src/commands/true.d.ts.map +1 -0
- package/src/commands/type.d.ts.map +1 -0
- package/src/commands/uname.d.ts.map +1 -0
- package/src/commands/uniq.d.ts.map +1 -0
- package/src/commands/unset.d.ts.map +1 -0
- package/src/commands/uptime.d.ts.map +1 -0
- package/src/commands/wc.d.ts.map +1 -0
- package/{dist → src}/commands/wc.js +1 -1
- package/src/commands/wc.ts +1 -1
- package/src/commands/wget.d.ts.map +1 -0
- package/src/commands/which.d.ts.map +1 -0
- package/src/commands/who.d.ts.map +1 -0
- package/src/commands/whoami.d.ts.map +1 -0
- package/src/commands/xargs.d.ts.map +1 -0
- package/src/index.d.ts.map +1 -0
- package/src/modules/linuxRootfs.d.ts +59 -0
- package/src/modules/linuxRootfs.d.ts.map +1 -0
- package/src/modules/linuxRootfs.js +619 -0
- package/src/modules/linuxRootfs.ts +420 -231
- package/src/modules/neofetch.d.ts.map +1 -0
- package/src/modules/shellInteractive.d.ts.map +1 -0
- package/src/modules/shellRuntime.d.ts.map +1 -0
- package/{dist → src}/self-standalone.d.ts.map +1 -1
- package/src/standalone-wo-sftp.d.ts.map +1 -0
- package/{dist → src}/standalone.d.ts.map +1 -1
- package/{dist → src}/types/commands.d.ts +1 -1
- package/src/types/commands.d.ts.map +1 -0
- package/src/types/commands.ts +1 -1
- package/src/types/pipeline.d.ts.map +1 -0
- package/src/types/streams.d.ts.map +1 -0
- package/src/types/vfs.d.ts.map +1 -0
- package/{dist → src}/utils/expand.d.ts +2 -2
- package/src/utils/expand.d.ts.map +1 -0
- package/src/utils/expand.js +476 -0
- package/src/utils/expand.ts +256 -76
- package/src/utils/perfLogger.d.ts.map +1 -0
- package/src/utils/tokenize.d.ts.map +1 -0
- package/src/utils/vfsDiff.d.ts.map +1 -0
- package/src/web-api.d.ts.map +1 -0
- package/src/web-full.d.ts.map +1 -0
- package/src/web.d.ts.map +1 -0
- package/tests/command-helpers.test.d.ts +2 -0
- package/tests/command-helpers.test.d.ts.map +1 -0
- package/tests/command-helpers.test.js +92 -0
- package/tests/command-helpers.test.ts +80 -0
- package/tests/commands-admin-net.test.d.ts +2 -0
- package/tests/commands-admin-net.test.d.ts.map +1 -0
- package/tests/commands-admin-net.test.js +353 -0
- package/tests/commands-admin-net.test.ts +441 -0
- package/tests/commands-advanced.test.d.ts +2 -0
- package/tests/commands-advanced.test.d.ts.map +1 -0
- package/tests/commands-advanced.test.js +378 -0
- package/tests/commands-advanced.test.ts +456 -0
- package/tests/commands-core.test.d.ts +2 -0
- package/tests/commands-core.test.d.ts.map +1 -0
- package/tests/commands-core.test.js +477 -0
- package/tests/commands-core.test.ts +562 -0
- package/tests/commands-missing.test.d.ts +2 -0
- package/tests/commands-missing.test.d.ts.map +1 -0
- package/tests/commands-missing.test.js +470 -0
- package/tests/commands-missing.test.ts +570 -0
- package/tests/commands-specific-units.test.d.ts +2 -0
- package/tests/commands-specific-units.test.d.ts.map +1 -0
- package/tests/commands-specific-units.test.js +264 -0
- package/tests/commands-specific-units.test.ts +327 -0
- package/tests/commands-text-sys.test.d.ts +2 -0
- package/tests/commands-text-sys.test.d.ts.map +1 -0
- package/tests/commands-text-sys.test.js +366 -0
- package/tests/commands-text-sys.test.ts +445 -0
- package/tests/expand.test.d.ts +2 -0
- package/tests/expand.test.d.ts.map +1 -0
- package/tests/expand.test.js +138 -0
- package/tests/expand.test.ts +170 -0
- package/tests/helpers.test.d.ts +2 -0
- package/tests/helpers.test.d.ts.map +1 -0
- package/tests/helpers.test.js +52 -0
- package/tests/helpers.test.ts +75 -0
- package/tests/new-features.test.d.ts +2 -0
- package/tests/new-features.test.d.ts.map +1 -0
- package/tests/new-features.test.js +850 -0
- package/tests/parser-executor.test.d.ts +2 -0
- package/tests/parser-executor.test.d.ts.map +1 -0
- package/tests/parser-executor.test.js +25 -0
- package/tests/sftp.test.d.ts +2 -0
- package/tests/sftp.test.d.ts.map +1 -0
- package/tests/sftp.test.js +246 -0
- package/tests/ssh-exec.test.d.ts +2 -0
- package/tests/ssh-exec.test.d.ts.map +1 -0
- package/tests/ssh-exec.test.js +39 -0
- package/tests/test-helper.d.ts +56 -0
- package/tests/test-helper.d.ts.map +1 -0
- package/tests/test-helper.js +71 -0
- package/tests/test-helper.ts +79 -0
- package/tests/users.test.d.ts +2 -0
- package/tests/users.test.d.ts.map +1 -0
- package/tests/users.test.js +71 -0
- package/tests/web.test.d.ts +2 -0
- package/tests/web.test.d.ts.map +1 -0
- package/tests/web.test.js +149 -0
- package/tsconfig.json +2 -4
- package/dist/Honeypot/index.d.ts.map +0 -1
- package/dist/SSHClient/index.d.ts.map +0 -1
- package/dist/SSHMimic/exec.d.ts.map +0 -1
- package/dist/SSHMimic/executor.d.ts.map +0 -1
- package/dist/SSHMimic/hostKey.d.ts.map +0 -1
- package/dist/SSHMimic/index.d.ts.map +0 -1
- package/dist/SSHMimic/loginBanner.d.ts.map +0 -1
- package/dist/SSHMimic/loginFormat.d.ts.map +0 -1
- package/dist/SSHMimic/prompt.d.ts.map +0 -1
- package/dist/SSHMimic/sftp.d.ts.map +0 -1
- package/dist/VirtualFileSystem/binaryPack.d.ts.map +0 -1
- package/dist/VirtualFileSystem/index.d.ts.map +0 -1
- package/dist/VirtualFileSystem/internalTypes.d.ts.map +0 -1
- package/dist/VirtualFileSystem/path.d.ts.map +0 -1
- package/dist/VirtualPackageManager/index.d.ts.map +0 -1
- package/dist/VirtualShell/index.d.ts.map +0 -1
- package/dist/VirtualShell/shell.d.ts.map +0 -1
- package/dist/VirtualShell/shellParser.d.ts.map +0 -1
- package/dist/VirtualUserManager/index.d.ts.map +0 -1
- package/dist/commands/adduser.d.ts.map +0 -1
- package/dist/commands/alias.d.ts.map +0 -1
- package/dist/commands/apt.d.ts.map +0 -1
- package/dist/commands/awk.d.ts.map +0 -1
- package/dist/commands/base64.d.ts.map +0 -1
- package/dist/commands/cat.d.ts.map +0 -1
- package/dist/commands/cd.d.ts.map +0 -1
- package/dist/commands/chmod.d.ts.map +0 -1
- package/dist/commands/clear.d.ts.map +0 -1
- package/dist/commands/command-helpers.d.ts.map +0 -1
- package/dist/commands/cp.d.ts.map +0 -1
- package/dist/commands/curl.d.ts.map +0 -1
- package/dist/commands/cut.d.ts.map +0 -1
- package/dist/commands/date.d.ts.map +0 -1
- package/dist/commands/declare.d.ts.map +0 -1
- package/dist/commands/deluser.d.ts.map +0 -1
- package/dist/commands/df.d.ts.map +0 -1
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/dpkg.d.ts.map +0 -1
- package/dist/commands/du.d.ts.map +0 -1
- package/dist/commands/echo.d.ts.map +0 -1
- package/dist/commands/env.d.ts.map +0 -1
- package/dist/commands/exit.d.ts.map +0 -1
- package/dist/commands/export.d.ts.map +0 -1
- package/dist/commands/find.d.ts.map +0 -1
- package/dist/commands/free.d.ts.map +0 -1
- package/dist/commands/grep.d.ts.map +0 -1
- package/dist/commands/groups.d.ts.map +0 -1
- package/dist/commands/gzip.d.ts.map +0 -1
- package/dist/commands/head.d.ts.map +0 -1
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/helpers.d.ts.map +0 -1
- package/dist/commands/history.d.ts.map +0 -1
- package/dist/commands/hostname.d.ts.map +0 -1
- package/dist/commands/htop.d.ts.map +0 -1
- package/dist/commands/id.d.ts.map +0 -1
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/kill.d.ts.map +0 -1
- package/dist/commands/ln.d.ts.map +0 -1
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -67
- package/dist/commands/lsb-release.d.ts.map +0 -1
- package/dist/commands/man.d.ts.map +0 -1
- package/dist/commands/mkdir.d.ts.map +0 -1
- package/dist/commands/mv.d.ts.map +0 -1
- package/dist/commands/nano.d.ts.map +0 -1
- package/dist/commands/neofetch.d.ts.map +0 -1
- package/dist/commands/node.d.ts.map +0 -1
- package/dist/commands/npm.d.ts.map +0 -1
- package/dist/commands/passwd.d.ts.map +0 -1
- package/dist/commands/ping.d.ts.map +0 -1
- package/dist/commands/printf.d.ts.map +0 -1
- package/dist/commands/ps.d.ts.map +0 -1
- package/dist/commands/pwd.d.ts.map +0 -1
- package/dist/commands/python.d.ts.map +0 -1
- package/dist/commands/read.d.ts.map +0 -1
- package/dist/commands/registry.d.ts.map +0 -1
- package/dist/commands/rm.d.ts.map +0 -1
- package/dist/commands/runtime.d.ts.map +0 -1
- package/dist/commands/sed.d.ts.map +0 -1
- package/dist/commands/seq.d.ts.map +0 -1
- package/dist/commands/set.d.ts.map +0 -1
- package/dist/commands/sh.d.ts.map +0 -1
- package/dist/commands/shift.d.ts.map +0 -1
- package/dist/commands/sleep.d.ts.map +0 -1
- package/dist/commands/sort.d.ts.map +0 -1
- package/dist/commands/source.d.ts.map +0 -1
- package/dist/commands/stat.d.ts.map +0 -1
- package/dist/commands/su.d.ts.map +0 -1
- package/dist/commands/sudo.d.ts.map +0 -1
- package/dist/commands/tail.d.ts.map +0 -1
- package/dist/commands/tar.d.ts.map +0 -1
- package/dist/commands/tee.d.ts.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/touch.d.ts.map +0 -1
- package/dist/commands/tr.d.ts.map +0 -1
- package/dist/commands/tree.d.ts.map +0 -1
- package/dist/commands/true.d.ts.map +0 -1
- package/dist/commands/type.d.ts.map +0 -1
- package/dist/commands/uname.d.ts.map +0 -1
- package/dist/commands/uniq.d.ts.map +0 -1
- package/dist/commands/unset.d.ts.map +0 -1
- package/dist/commands/uptime.d.ts.map +0 -1
- package/dist/commands/wc.d.ts.map +0 -1
- package/dist/commands/wget.d.ts.map +0 -1
- package/dist/commands/which.d.ts.map +0 -1
- package/dist/commands/who.d.ts.map +0 -1
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/xargs.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/modules/linuxRootfs.d.ts +0 -41
- package/dist/modules/linuxRootfs.d.ts.map +0 -1
- package/dist/modules/linuxRootfs.js +0 -440
- package/dist/modules/neofetch.d.ts.map +0 -1
- package/dist/modules/shellInteractive.d.ts.map +0 -1
- package/dist/modules/shellRuntime.d.ts.map +0 -1
- package/dist/standalone-wo-sftp.d.ts.map +0 -1
- package/dist/types/commands.d.ts.map +0 -1
- package/dist/types/pipeline.d.ts.map +0 -1
- package/dist/types/streams.d.ts.map +0 -1
- package/dist/types/vfs.d.ts.map +0 -1
- package/dist/utils/expand.d.ts.map +0 -1
- package/dist/utils/expand.js +0 -265
- package/dist/utils/perfLogger.d.ts.map +0 -1
- package/dist/utils/tokenize.d.ts.map +0 -1
- package/dist/utils/vfsDiff.d.ts.map +0 -1
- package/dist/web-api.d.ts.map +0 -1
- package/dist/web-full.d.ts.map +0 -1
- package/dist/web.d.ts.map +0 -1
- package/tests/bun-test-shim.ts +0 -9
- /package/{dist → src}/Honeypot/index.d.ts +0 -0
- /package/{dist → src}/Honeypot/index.js +0 -0
- /package/{dist → src}/SSHClient/index.d.ts +0 -0
- /package/{dist → src}/SSHClient/index.js +0 -0
- /package/{dist → src}/SSHMimic/exec.d.ts +0 -0
- /package/{dist → src}/SSHMimic/exec.js +0 -0
- /package/{dist → src}/SSHMimic/executor.d.ts +0 -0
- /package/{dist → src}/SSHMimic/executor.js +0 -0
- /package/{dist → src}/SSHMimic/hostKey.d.ts +0 -0
- /package/{dist → src}/SSHMimic/hostKey.js +0 -0
- /package/{dist → src}/SSHMimic/index.d.ts +0 -0
- /package/{dist → src}/SSHMimic/index.js +0 -0
- /package/{dist → src}/SSHMimic/loginBanner.d.ts +0 -0
- /package/{dist → src}/SSHMimic/loginBanner.js +0 -0
- /package/{dist → src}/SSHMimic/loginFormat.d.ts +0 -0
- /package/{dist → src}/SSHMimic/loginFormat.js +0 -0
- /package/{dist → src}/SSHMimic/prompt.d.ts +0 -0
- /package/{dist → src}/SSHMimic/prompt.js +0 -0
- /package/{dist → src}/SSHMimic/sftp.d.ts +0 -0
- /package/{dist → src}/SSHMimic/sftp.js +0 -0
- /package/{dist → src}/VirtualFileSystem/binaryPack.d.ts +0 -0
- /package/{dist → src}/VirtualFileSystem/binaryPack.js +0 -0
- /package/{dist → src}/VirtualFileSystem/index.d.ts +0 -0
- /package/{dist → src}/VirtualFileSystem/index.js +0 -0
- /package/{dist → src}/VirtualFileSystem/internalTypes.d.ts +0 -0
- /package/{dist → src}/VirtualFileSystem/internalTypes.js +0 -0
- /package/{dist → src}/VirtualFileSystem/path.d.ts +0 -0
- /package/{dist → src}/VirtualFileSystem/path.js +0 -0
- /package/{dist → src}/VirtualPackageManager/index.d.ts +0 -0
- /package/{dist → src}/VirtualPackageManager/index.js +0 -0
- /package/{dist → src}/VirtualShell/index.d.ts +0 -0
- /package/{dist → src}/VirtualShell/index.js +0 -0
- /package/{dist → src}/VirtualShell/shell.d.ts +0 -0
- /package/{dist → src}/VirtualShell/shell.js +0 -0
- /package/{dist → src}/VirtualShell/shellParser.d.ts +0 -0
- /package/{dist → src}/VirtualUserManager/index.d.ts +0 -0
- /package/{dist → src}/VirtualUserManager/index.js +0 -0
- /package/{dist → src}/commands/adduser.d.ts +0 -0
- /package/{dist → src}/commands/adduser.js +0 -0
- /package/{dist → src}/commands/alias.d.ts +0 -0
- /package/{dist → src}/commands/alias.js +0 -0
- /package/{dist → src}/commands/apt.d.ts +0 -0
- /package/{dist → src}/commands/apt.js +0 -0
- /package/{dist → src}/commands/awk.d.ts +0 -0
- /package/{dist → src}/commands/base64.d.ts +0 -0
- /package/{dist → src}/commands/base64.js +0 -0
- /package/{dist → src}/commands/cat.d.ts +0 -0
- /package/{dist → src}/commands/cat.js +0 -0
- /package/{dist → src}/commands/cd.d.ts +0 -0
- /package/{dist → src}/commands/chmod.d.ts +0 -0
- /package/{dist → src}/commands/chmod.js +0 -0
- /package/{dist → src}/commands/clear.d.ts +0 -0
- /package/{dist → src}/commands/clear.js +0 -0
- /package/{dist → src}/commands/command-helpers.d.ts +0 -0
- /package/{dist → src}/commands/command-helpers.js +0 -0
- /package/{dist → src}/commands/cp.d.ts +0 -0
- /package/{dist → src}/commands/cp.js +0 -0
- /package/{dist → src}/commands/curl.d.ts +0 -0
- /package/{dist → src}/commands/curl.js +0 -0
- /package/{dist → src}/commands/cut.d.ts +0 -0
- /package/{dist → src}/commands/cut.js +0 -0
- /package/{dist → src}/commands/date.d.ts +0 -0
- /package/{dist → src}/commands/date.js +0 -0
- /package/{dist → src}/commands/declare.d.ts +0 -0
- /package/{dist → src}/commands/declare.js +0 -0
- /package/{dist → src}/commands/deluser.d.ts +0 -0
- /package/{dist → src}/commands/deluser.js +0 -0
- /package/{dist → src}/commands/df.d.ts +0 -0
- /package/{dist → src}/commands/df.js +0 -0
- /package/{dist → src}/commands/diff.d.ts +0 -0
- /package/{dist → src}/commands/diff.js +0 -0
- /package/{dist → src}/commands/dpkg.d.ts +0 -0
- /package/{dist → src}/commands/dpkg.js +0 -0
- /package/{dist → src}/commands/du.d.ts +0 -0
- /package/{dist → src}/commands/du.js +0 -0
- /package/{dist → src}/commands/echo.d.ts +0 -0
- /package/{dist → src}/commands/echo.js +0 -0
- /package/{dist → src}/commands/env.d.ts +0 -0
- /package/{dist → src}/commands/env.js +0 -0
- /package/{dist → src}/commands/exit.d.ts +0 -0
- /package/{dist → src}/commands/exit.js +0 -0
- /package/{dist → src}/commands/export.d.ts +0 -0
- /package/{dist → src}/commands/export.js +0 -0
- /package/{dist → src}/commands/find.d.ts +0 -0
- /package/{dist → src}/commands/find.js +0 -0
- /package/{dist → src}/commands/free.d.ts +0 -0
- /package/{dist → src}/commands/free.js +0 -0
- /package/{dist → src}/commands/grep.d.ts +0 -0
- /package/{dist → src}/commands/grep.js +0 -0
- /package/{dist → src}/commands/groups.d.ts +0 -0
- /package/{dist → src}/commands/groups.js +0 -0
- /package/{dist → src}/commands/gzip.d.ts +0 -0
- /package/{dist → src}/commands/gzip.js +0 -0
- /package/{dist → src}/commands/head.d.ts +0 -0
- /package/{dist → src}/commands/head.js +0 -0
- /package/{dist → src}/commands/help.d.ts +0 -0
- /package/{dist → src}/commands/help.js +0 -0
- /package/{dist → src}/commands/helpers.d.ts +0 -0
- /package/{dist → src}/commands/history.d.ts +0 -0
- /package/{dist → src}/commands/history.js +0 -0
- /package/{dist → src}/commands/hostname.d.ts +0 -0
- /package/{dist → src}/commands/hostname.js +0 -0
- /package/{dist → src}/commands/htop.d.ts +0 -0
- /package/{dist → src}/commands/htop.js +0 -0
- /package/{dist → src}/commands/id.d.ts +0 -0
- /package/{dist → src}/commands/id.js +0 -0
- /package/{dist → src}/commands/index.d.ts +0 -0
- /package/{dist → src}/commands/index.js +0 -0
- /package/{dist → src}/commands/kill.d.ts +0 -0
- /package/{dist → src}/commands/kill.js +0 -0
- /package/{dist → src}/commands/ln.d.ts +0 -0
- /package/{dist → src}/commands/ln.js +0 -0
- /package/{dist → src}/commands/ls.d.ts +0 -0
- /package/{dist → src}/commands/lsb-release.d.ts +0 -0
- /package/{dist → src}/commands/lsb-release.js +0 -0
- /package/{dist → src}/commands/man.d.ts +0 -0
- /package/{dist → src}/commands/man.js +0 -0
- /package/{dist → src}/commands/mkdir.d.ts +0 -0
- /package/{dist → src}/commands/mkdir.js +0 -0
- /package/{dist → src}/commands/mv.d.ts +0 -0
- /package/{dist → src}/commands/mv.js +0 -0
- /package/{dist → src}/commands/nano.d.ts +0 -0
- /package/{dist → src}/commands/nano.js +0 -0
- /package/{dist → src}/commands/neofetch.d.ts +0 -0
- /package/{dist → src}/commands/neofetch.js +0 -0
- /package/{dist → src}/commands/node.d.ts +0 -0
- /package/{dist → src}/commands/node.js +0 -0
- /package/{dist → src}/commands/npm.d.ts +0 -0
- /package/{dist → src}/commands/npm.js +0 -0
- /package/{dist → src}/commands/passwd.d.ts +0 -0
- /package/{dist → src}/commands/passwd.js +0 -0
- /package/{dist → src}/commands/ping.d.ts +0 -0
- /package/{dist → src}/commands/ping.js +0 -0
- /package/{dist → src}/commands/printf.d.ts +0 -0
- /package/{dist → src}/commands/printf.js +0 -0
- /package/{dist → src}/commands/ps.d.ts +0 -0
- /package/{dist → src}/commands/ps.js +0 -0
- /package/{dist → src}/commands/pwd.d.ts +0 -0
- /package/{dist → src}/commands/pwd.js +0 -0
- /package/{dist → src}/commands/python.d.ts +0 -0
- /package/{dist → src}/commands/python.js +0 -0
- /package/{dist → src}/commands/read.d.ts +0 -0
- /package/{dist → src}/commands/read.js +0 -0
- /package/{dist → src}/commands/registry.d.ts +0 -0
- /package/{dist → src}/commands/registry.js +0 -0
- /package/{dist → src}/commands/rm.d.ts +0 -0
- /package/{dist → src}/commands/rm.js +0 -0
- /package/{dist → src}/commands/runtime.d.ts +0 -0
- /package/{dist → src}/commands/sed.d.ts +0 -0
- /package/{dist → src}/commands/sed.js +0 -0
- /package/{dist → src}/commands/seq.d.ts +0 -0
- /package/{dist → src}/commands/seq.js +0 -0
- /package/{dist → src}/commands/set.d.ts +0 -0
- /package/{dist → src}/commands/set.js +0 -0
- /package/{dist → src}/commands/sh.d.ts +0 -0
- /package/{dist → src}/commands/shift.d.ts +0 -0
- /package/{dist → src}/commands/shift.js +0 -0
- /package/{dist → src}/commands/sleep.d.ts +0 -0
- /package/{dist → src}/commands/sleep.js +0 -0
- /package/{dist → src}/commands/sort.d.ts +0 -0
- /package/{dist → src}/commands/sort.js +0 -0
- /package/{dist → src}/commands/source.d.ts +0 -0
- /package/{dist → src}/commands/source.js +0 -0
- /package/{dist → src}/commands/stat.d.ts +0 -0
- /package/{dist → src}/commands/stat.js +0 -0
- /package/{dist → src}/commands/su.d.ts +0 -0
- /package/{dist → src}/commands/su.js +0 -0
- /package/{dist → src}/commands/sudo.d.ts +0 -0
- /package/{dist → src}/commands/sudo.js +0 -0
- /package/{dist → src}/commands/tail.d.ts +0 -0
- /package/{dist → src}/commands/tail.js +0 -0
- /package/{dist → src}/commands/tar.d.ts +0 -0
- /package/{dist → src}/commands/tar.js +0 -0
- /package/{dist → src}/commands/tee.d.ts +0 -0
- /package/{dist → src}/commands/tee.js +0 -0
- /package/{dist → src}/commands/test.d.ts +0 -0
- /package/{dist → src}/commands/test.js +0 -0
- /package/{dist → src}/commands/touch.d.ts +0 -0
- /package/{dist → src}/commands/touch.js +0 -0
- /package/{dist → src}/commands/tr.d.ts +0 -0
- /package/{dist → src}/commands/tr.js +0 -0
- /package/{dist → src}/commands/tree.d.ts +0 -0
- /package/{dist → src}/commands/tree.js +0 -0
- /package/{dist → src}/commands/true.d.ts +0 -0
- /package/{dist → src}/commands/true.js +0 -0
- /package/{dist → src}/commands/type.d.ts +0 -0
- /package/{dist → src}/commands/type.js +0 -0
- /package/{dist → src}/commands/uname.d.ts +0 -0
- /package/{dist → src}/commands/uname.js +0 -0
- /package/{dist → src}/commands/uniq.d.ts +0 -0
- /package/{dist → src}/commands/uniq.js +0 -0
- /package/{dist → src}/commands/unset.d.ts +0 -0
- /package/{dist → src}/commands/unset.js +0 -0
- /package/{dist → src}/commands/uptime.d.ts +0 -0
- /package/{dist → src}/commands/uptime.js +0 -0
- /package/{dist → src}/commands/wc.d.ts +0 -0
- /package/{dist → src}/commands/wget.d.ts +0 -0
- /package/{dist → src}/commands/wget.js +0 -0
- /package/{dist → src}/commands/which.d.ts +0 -0
- /package/{dist → src}/commands/which.js +0 -0
- /package/{dist → src}/commands/who.d.ts +0 -0
- /package/{dist → src}/commands/who.js +0 -0
- /package/{dist → src}/commands/whoami.d.ts +0 -0
- /package/{dist → src}/commands/whoami.js +0 -0
- /package/{dist → src}/commands/xargs.d.ts +0 -0
- /package/{dist → src}/commands/xargs.js +0 -0
- /package/{dist → src}/index.d.ts +0 -0
- /package/{dist → src}/index.js +0 -0
- /package/{dist → src}/modules/neofetch.d.ts +0 -0
- /package/{dist → src}/modules/neofetch.js +0 -0
- /package/{dist → src}/modules/shellInteractive.d.ts +0 -0
- /package/{dist → src}/modules/shellInteractive.js +0 -0
- /package/{dist → src}/modules/shellRuntime.d.ts +0 -0
- /package/{dist → src}/modules/shellRuntime.js +0 -0
- /package/{dist → src}/self-standalone.d.ts +0 -0
- /package/{dist → src}/self-standalone.js +0 -0
- /package/{dist → src}/standalone-wo-sftp.d.ts +0 -0
- /package/{dist → src}/standalone-wo-sftp.js +0 -0
- /package/{dist → src}/standalone.d.ts +0 -0
- /package/{dist → src}/standalone.js +0 -0
- /package/{dist → src}/types/commands.js +0 -0
- /package/{dist → src}/types/pipeline.d.ts +0 -0
- /package/{dist → src}/types/pipeline.js +0 -0
- /package/{dist → src}/types/streams.d.ts +0 -0
- /package/{dist → src}/types/streams.js +0 -0
- /package/{dist → src}/types/vfs.d.ts +0 -0
- /package/{dist → src}/types/vfs.js +0 -0
- /package/{dist → src}/utils/perfLogger.d.ts +0 -0
- /package/{dist → src}/utils/perfLogger.js +0 -0
- /package/{dist → src}/utils/tokenize.d.ts +0 -0
- /package/{dist → src}/utils/tokenize.js +0 -0
- /package/{dist → src}/utils/vfsDiff.d.ts +0 -0
- /package/{dist → src}/utils/vfsDiff.js +0 -0
- /package/{dist → src}/web-api.d.ts +0 -0
- /package/{dist → src}/web-api.js +0 -0
- /package/{dist → src}/web-full.d.ts +0 -0
- /package/{dist → src}/web-full.js +0 -0
- /package/{dist → src}/web.d.ts +0 -0
- /package/{dist → src}/web.js +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import { createTestDir, createTestEnv, createTestFile, runCmd } from "./test-helper";
|
|
3
|
+
let shell;
|
|
4
|
+
let client;
|
|
5
|
+
beforeAll(async () => {
|
|
6
|
+
const env = await createTestEnv("test-advanced");
|
|
7
|
+
shell = env.shell;
|
|
8
|
+
client = env.client;
|
|
9
|
+
});
|
|
10
|
+
// ─── FIND tests ───────────────────────────────────────────────────────────
|
|
11
|
+
describe("find command", () => {
|
|
12
|
+
test("find lists files in directory", async () => {
|
|
13
|
+
createTestFile(shell, "/tmp/find1.txt", "test");
|
|
14
|
+
createTestFile(shell, "/tmp/find2.txt", "test");
|
|
15
|
+
const r = await runCmd(client, "find /tmp -name 'find*.txt'");
|
|
16
|
+
expect(r.exitCode).toBe(0);
|
|
17
|
+
expect(r.stdout).toContain("find1.txt");
|
|
18
|
+
expect(r.stdout).toContain("find2.txt");
|
|
19
|
+
});
|
|
20
|
+
test("find -name pattern matching", async () => {
|
|
21
|
+
createTestFile(shell, "/tmp/test.log", "log");
|
|
22
|
+
createTestFile(shell, "/tmp/test.txt", "txt");
|
|
23
|
+
const r = await runCmd(client, "find /tmp -name '*.log'");
|
|
24
|
+
expect(r.exitCode).toBe(0);
|
|
25
|
+
expect(r.stdout).toContain("test.log");
|
|
26
|
+
expect(r.stdout).not.toContain("test.txt");
|
|
27
|
+
});
|
|
28
|
+
test("find -type f files only", async () => {
|
|
29
|
+
await createTestDir(shell, "/tmp/finddir");
|
|
30
|
+
createTestFile(shell, "/tmp/finddir/file.txt", "test");
|
|
31
|
+
const r = await runCmd(client, "find /tmp/finddir -type f");
|
|
32
|
+
expect(r.exitCode).toBe(0);
|
|
33
|
+
expect(r.stdout).toContain("file.txt");
|
|
34
|
+
});
|
|
35
|
+
test("find -type d directories only", async () => {
|
|
36
|
+
await createTestDir(shell, "/tmp/finddir2/subdir");
|
|
37
|
+
const r = await runCmd(client, "find /tmp/finddir2 -type d");
|
|
38
|
+
expect(r.exitCode).toBe(0);
|
|
39
|
+
expect(r.stdout).toContain("subdir");
|
|
40
|
+
});
|
|
41
|
+
test("find recursive into subdirs", async () => {
|
|
42
|
+
await createTestDir(shell, "/tmp/findrecur/sub1/sub2");
|
|
43
|
+
createTestFile(shell, "/tmp/findrecur/file.txt", "top");
|
|
44
|
+
createTestFile(shell, "/tmp/findrecur/sub1/file.txt", "sub1");
|
|
45
|
+
createTestFile(shell, "/tmp/findrecur/sub1/sub2/file.txt", "sub2");
|
|
46
|
+
const r = await runCmd(client, "find /tmp/findrecur -name 'file.txt'");
|
|
47
|
+
expect(r.exitCode).toBe(0);
|
|
48
|
+
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
49
|
+
expect(lines?.length).toBeGreaterThanOrEqual(3);
|
|
50
|
+
});
|
|
51
|
+
test("find non-existent path", async () => {
|
|
52
|
+
const r = await runCmd(client, "find /nonexistent -type f");
|
|
53
|
+
expect(r.exitCode).not.toBe(0);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
// ─── DIFF tests ────────────────────────────────────────────────────────────
|
|
57
|
+
describe("diff command", () => {
|
|
58
|
+
test("diff identical files", async () => {
|
|
59
|
+
createTestFile(shell, "/tmp/diff1.txt", "line1\nline2\nline3");
|
|
60
|
+
createTestFile(shell, "/tmp/diff2.txt", "line1\nline2\nline3");
|
|
61
|
+
const r = await runCmd(client, "diff /tmp/diff1.txt /tmp/diff2.txt");
|
|
62
|
+
expect(r.exitCode).toBe(0);
|
|
63
|
+
expect(r.stdout).toBe("");
|
|
64
|
+
});
|
|
65
|
+
test("diff different files", async () => {
|
|
66
|
+
createTestFile(shell, "/tmp/diffA.txt", "line1\nline2");
|
|
67
|
+
createTestFile(shell, "/tmp/diffB.txt", "line1\nchanged");
|
|
68
|
+
const r = await runCmd(client, "diff /tmp/diffA.txt /tmp/diffB.txt");
|
|
69
|
+
expect(r.exitCode).not.toBe(0);
|
|
70
|
+
expect(r.stdout).toContain("line2");
|
|
71
|
+
expect(r.stdout).toContain("changed");
|
|
72
|
+
});
|
|
73
|
+
test("diff with context", async () => {
|
|
74
|
+
createTestFile(shell, "/tmp/diffctx1.txt", "a\nb\nc\nd\ne");
|
|
75
|
+
createTestFile(shell, "/tmp/diffctx2.txt", "a\nb\nX\nd\ne");
|
|
76
|
+
const r = await runCmd(client, "diff /tmp/diffctx1.txt /tmp/diffctx2.txt");
|
|
77
|
+
expect(r.exitCode).not.toBe(0);
|
|
78
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
79
|
+
});
|
|
80
|
+
test("diff missing file", async () => {
|
|
81
|
+
const r = await runCmd(client, "diff /nonexist1.txt /nonexist2.txt");
|
|
82
|
+
expect(r.exitCode).not.toBe(0);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
// ─── DU tests ──────────────────────────────────────────────────────────────
|
|
86
|
+
describe("du command", () => {
|
|
87
|
+
test("du directory size", async () => {
|
|
88
|
+
createTestFile(shell, "/tmp/dutest/file1.txt", "content");
|
|
89
|
+
createTestFile(shell, "/tmp/dutest/file2.txt", "content");
|
|
90
|
+
const r = await runCmd(client, "du /tmp/dutest");
|
|
91
|
+
expect(r.exitCode).toBe(0);
|
|
92
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
93
|
+
});
|
|
94
|
+
test("du -h human readable", async () => {
|
|
95
|
+
createTestFile(shell, "/tmp/duh/large.txt", "a".repeat(2000));
|
|
96
|
+
const r = await runCmd(client, "du -h /tmp/duh");
|
|
97
|
+
expect(r.exitCode).toBe(0);
|
|
98
|
+
expect(r.stdout).toMatch(/K|M|G|B/);
|
|
99
|
+
});
|
|
100
|
+
test("du -s summary only", async () => {
|
|
101
|
+
createTestFile(shell, "/tmp/dus/file.txt", "test");
|
|
102
|
+
const r = await runCmd(client, "du -s /tmp/dus");
|
|
103
|
+
expect(r.exitCode).toBe(0);
|
|
104
|
+
const lines = r.stdout?.split("\n").filter((l) => l);
|
|
105
|
+
expect(lines?.length).toBe(1);
|
|
106
|
+
});
|
|
107
|
+
test("du non-existent", async () => {
|
|
108
|
+
const r = await runCmd(client, "du /nonexistent");
|
|
109
|
+
expect(r.exitCode).not.toBe(0);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
// ─── DF tests ──────────────────────────────────────────────────────────────
|
|
113
|
+
describe("df command", () => {
|
|
114
|
+
test("df shows filesystem info", async () => {
|
|
115
|
+
const r = await runCmd(client, "df");
|
|
116
|
+
expect(r.exitCode).toBe(0);
|
|
117
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
118
|
+
});
|
|
119
|
+
test("df -h human readable", async () => {
|
|
120
|
+
const r = await runCmd(client, "df -h");
|
|
121
|
+
expect(r.exitCode).toBe(0);
|
|
122
|
+
expect(r.stdout).toMatch(/K|M|G/i);
|
|
123
|
+
});
|
|
124
|
+
test("df specific path", async () => {
|
|
125
|
+
const r = await runCmd(client, "df /tmp");
|
|
126
|
+
expect(r.exitCode).toBe(0);
|
|
127
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
128
|
+
});
|
|
129
|
+
test("df with home directory", async () => {
|
|
130
|
+
const r = await runCmd(client, "df /root");
|
|
131
|
+
expect(r.exitCode).toBe(0);
|
|
132
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
// ─── STAT tests ───────────────────────────────────────────────────────────
|
|
136
|
+
describe("stat command", () => {
|
|
137
|
+
test("stat file info", async () => {
|
|
138
|
+
createTestFile(shell, "/tmp/statfile.txt", "content");
|
|
139
|
+
const r = await runCmd(client, "stat /tmp/statfile.txt");
|
|
140
|
+
expect(r.exitCode).toBe(0);
|
|
141
|
+
expect(r.stdout).toContain("File");
|
|
142
|
+
expect(r.stdout).toContain("Access");
|
|
143
|
+
});
|
|
144
|
+
test("stat directory", async () => {
|
|
145
|
+
const r = await runCmd(client, "stat /tmp");
|
|
146
|
+
expect(r.exitCode).toBe(0);
|
|
147
|
+
expect(r.stdout).toContain("File");
|
|
148
|
+
});
|
|
149
|
+
test("stat shows mode", async () => {
|
|
150
|
+
createTestFile(shell, "/tmp/statmode.txt", "test");
|
|
151
|
+
const r = await runCmd(client, "stat /tmp/statmode.txt");
|
|
152
|
+
expect(r.exitCode).toBe(0);
|
|
153
|
+
expect(r.stdout).toMatch(/\d+/);
|
|
154
|
+
});
|
|
155
|
+
test("stat non-existent", async () => {
|
|
156
|
+
const r = await runCmd(client, "stat /nonexistent");
|
|
157
|
+
expect(r.exitCode).not.toBe(0);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
// ─── TAR tests ────────────────────────────────────────────────────────────
|
|
161
|
+
describe("tar command", () => {
|
|
162
|
+
test("tar -cf creates archive", async () => {
|
|
163
|
+
createTestFile(shell, "/tmp/tartest/file1.txt", "data1");
|
|
164
|
+
createTestFile(shell, "/tmp/tartest/file2.txt", "data2");
|
|
165
|
+
const r = await runCmd(client, "tar -cf /tmp/archive.tar /tmp/tartest");
|
|
166
|
+
expect(r.exitCode).toBe(0);
|
|
167
|
+
expect(shell.vfs.exists("/tmp/archive.tar")).toBe(true);
|
|
168
|
+
});
|
|
169
|
+
test("tar -tf lists contents", async () => {
|
|
170
|
+
createTestFile(shell, "/tmp/tarlist/file.txt", "content");
|
|
171
|
+
await runCmd(client, "tar -cf /tmp/list.tar /tmp/tarlist");
|
|
172
|
+
const r = await runCmd(client, "tar -tf /tmp/list.tar");
|
|
173
|
+
expect(r.exitCode).toBe(0);
|
|
174
|
+
expect(r.stdout).toContain("file.txt");
|
|
175
|
+
});
|
|
176
|
+
test("tar -xf extracts archive", async () => {
|
|
177
|
+
createTestFile(shell, "/tmp/tarext/source.txt", "original");
|
|
178
|
+
await runCmd(client, "tar -cf /tmp/extract.tar /tmp/tarext");
|
|
179
|
+
await runCmd(client, "mkdir -p /tmp/extracted");
|
|
180
|
+
const r = await runCmd(client, "tar -xf /tmp/extract.tar -C /tmp/extracted");
|
|
181
|
+
expect(r.exitCode).toBe(0);
|
|
182
|
+
});
|
|
183
|
+
test("tar -czf gzip compression", async () => {
|
|
184
|
+
createTestFile(shell, "/tmp/targz/file.txt", "data");
|
|
185
|
+
const r = await runCmd(client, "tar -czf /tmp/archive.tar.gz /tmp/targz");
|
|
186
|
+
expect(r.exitCode).toBe(0);
|
|
187
|
+
expect(shell.vfs.exists("/tmp/archive.tar.gz")).toBe(true);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
// ─── GZIP tests ───────────────────────────────────────────────────────────
|
|
191
|
+
describe("gzip command", () => {
|
|
192
|
+
test("gzip compresses file", async () => {
|
|
193
|
+
createTestFile(shell, "/tmp/gzipme2.txt", "a".repeat(1000));
|
|
194
|
+
const r = await runCmd(client, "gzip /tmp/gzipme2.txt || echo 'compressed'");
|
|
195
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
196
|
+
});
|
|
197
|
+
test("gzip -c keeps original", async () => {
|
|
198
|
+
createTestFile(shell, "/tmp/gzipkeep2.txt", "data");
|
|
199
|
+
const r = await runCmd(client, "gzip -c /tmp/gzipkeep2.txt > /tmp/gzipkeep.gz || echo 'done'");
|
|
200
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
201
|
+
});
|
|
202
|
+
test("gzip -d decompresses", async () => {
|
|
203
|
+
createTestFile(shell, "/tmp/togzip2.txt", "compress me");
|
|
204
|
+
await runCmd(client, "gzip /tmp/togzip2.txt || echo 'done'");
|
|
205
|
+
const r = await runCmd(client, "gzip -d /tmp/togzip2.txt.gz || echo 'done'");
|
|
206
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
// ─── FREE tests ───────────────────────────────────────────────────────────
|
|
210
|
+
describe("free command", () => {
|
|
211
|
+
test("free shows memory info", async () => {
|
|
212
|
+
const r = await runCmd(client, "free");
|
|
213
|
+
expect(r.exitCode).toBe(0);
|
|
214
|
+
expect(r.stdout).toContain("Mem");
|
|
215
|
+
expect(r.stdout).toContain("total");
|
|
216
|
+
});
|
|
217
|
+
test("free -h human readable", async () => {
|
|
218
|
+
const r = await runCmd(client, "free -h");
|
|
219
|
+
expect(r.exitCode).toBe(0);
|
|
220
|
+
expect(r.stdout).toMatch(/M|G|K/);
|
|
221
|
+
});
|
|
222
|
+
test("free -b bytes", async () => {
|
|
223
|
+
const r = await runCmd(client, "free -b");
|
|
224
|
+
expect(r.exitCode).toBe(0);
|
|
225
|
+
expect(r.stdout).toContain("total");
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
// ─── UPTIME tests ────────────────────────────────────────────────────────
|
|
229
|
+
describe("uptime command", () => {
|
|
230
|
+
test("uptime shows system uptime", async () => {
|
|
231
|
+
const r = await runCmd(client, "uptime");
|
|
232
|
+
expect(r.exitCode).toBe(0);
|
|
233
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
234
|
+
});
|
|
235
|
+
test("uptime contains time", async () => {
|
|
236
|
+
const r = await runCmd(client, "uptime");
|
|
237
|
+
expect(r.stdout).toMatch(/\d+:\d+/);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
// ─── PS tests ──────────────────────────────────────────────────────────────
|
|
241
|
+
describe("ps command", () => {
|
|
242
|
+
test("ps lists processes", async () => {
|
|
243
|
+
const r = await runCmd(client, "ps");
|
|
244
|
+
expect(r.exitCode).toBe(0);
|
|
245
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
246
|
+
});
|
|
247
|
+
test("ps aux detailed", async () => {
|
|
248
|
+
const r = await runCmd(client, "ps aux");
|
|
249
|
+
expect(r.exitCode).toBe(0);
|
|
250
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
251
|
+
});
|
|
252
|
+
test("ps contains headers", async () => {
|
|
253
|
+
const r = await runCmd(client, "ps");
|
|
254
|
+
expect(r.stdout).toMatch(/PID|USER|CMD/i);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
// ─── KILL tests ───────────────────────────────────────────────────────────
|
|
258
|
+
describe("kill command", () => {
|
|
259
|
+
test("kill with invalid PID fails", async () => {
|
|
260
|
+
const r = await runCmd(client, "kill 99999 2>&1 || echo 'failed'");
|
|
261
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
262
|
+
});
|
|
263
|
+
test("kill -l lists signals", async () => {
|
|
264
|
+
const r = await runCmd(client, "kill -l || echo 'KILL'");
|
|
265
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
// ─── LN tests ──────────────────────────────────────────────────────────────
|
|
269
|
+
describe("ln command", () => {
|
|
270
|
+
test("ln -s creates symlink", async () => {
|
|
271
|
+
createTestFile(shell, "/tmp/lnoriginal.txt", "content");
|
|
272
|
+
const r = await runCmd(client, "ln -s /tmp/lnoriginal.txt /tmp/lnlink.txt");
|
|
273
|
+
expect(r.exitCode).toBe(0);
|
|
274
|
+
expect(shell.vfs.isSymlink("/tmp/lnlink.txt")).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
test("ln hard link", async () => {
|
|
277
|
+
createTestFile(shell, "/tmp/lnhard.txt", "data");
|
|
278
|
+
const r = await runCmd(client, "ln /tmp/lnhard.txt /tmp/lnhard2.txt");
|
|
279
|
+
expect(r.exitCode).toBe(0);
|
|
280
|
+
});
|
|
281
|
+
test("ln to directory", async () => {
|
|
282
|
+
createTestFile(shell, "/tmp/lntodir/file.txt", "test");
|
|
283
|
+
const r = await runCmd(client, "ln -s /tmp/lntodir/file.txt /tmp/lntodir/link");
|
|
284
|
+
expect(r.exitCode).toBe(0);
|
|
285
|
+
});
|
|
286
|
+
test("ln duplicate fails", async () => {
|
|
287
|
+
createTestFile(shell, "/tmp/lndup2.txt", "dup");
|
|
288
|
+
await runCmd(client, "ln -s /tmp/lndup2.txt /tmp/lndup-link2.txt 2>/dev/null || true");
|
|
289
|
+
const r = await runCmd(client, "ln -s /tmp/lndup2.txt /tmp/lndup-link2.txt 2>&1 || echo 'error'");
|
|
290
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
// ─── FILE tests ───────────────────────────────────────────────────────────
|
|
294
|
+
describe("file command", () => {
|
|
295
|
+
test("file text file", async () => {
|
|
296
|
+
createTestFile(shell, "/tmp/filetype2.txt", "hello");
|
|
297
|
+
const r = await runCmd(client, "file /tmp/filetype2.txt || echo 'text'");
|
|
298
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
299
|
+
});
|
|
300
|
+
test("file directory", async () => {
|
|
301
|
+
const r = await runCmd(client, "file /tmp || echo 'directory'");
|
|
302
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
303
|
+
});
|
|
304
|
+
test("file symlink", async () => {
|
|
305
|
+
createTestFile(shell, "/tmp/filelink-target2.txt", "target");
|
|
306
|
+
await runCmd(client, "ln -s /tmp/filelink-target2.txt /tmp/filelink2 2>/dev/null || true");
|
|
307
|
+
const r = await runCmd(client, "file /tmp/filelink2 || echo 'link'");
|
|
308
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
309
|
+
});
|
|
310
|
+
test("file non-existent", async () => {
|
|
311
|
+
const r = await runCmd(client, "file /nonexist");
|
|
312
|
+
expect(r.exitCode).not.toBe(0);
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
// ─── TREE tests ───────────────────────────────────────────────────────────
|
|
316
|
+
describe("tree command", () => {
|
|
317
|
+
test("tree displays directory structure", async () => {
|
|
318
|
+
createTestFile(shell, "/tmp/tree1/sub1/file.txt", "test");
|
|
319
|
+
createTestFile(shell, "/tmp/tree1/sub2/file.txt", "test");
|
|
320
|
+
const r = await runCmd(client, "tree /tmp/tree1");
|
|
321
|
+
expect(r.exitCode).toBe(0);
|
|
322
|
+
expect(r.stdout).toContain("sub1");
|
|
323
|
+
expect(r.stdout).toContain("sub2");
|
|
324
|
+
});
|
|
325
|
+
test("tree -L limits depth", async () => {
|
|
326
|
+
await createTestDir(shell, "/tmp/treedepth2/a/b/c");
|
|
327
|
+
const r = await runCmd(client, "tree -L 2 /tmp/treedepth2 || echo 'tree'");
|
|
328
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
329
|
+
});
|
|
330
|
+
test("tree single file", async () => {
|
|
331
|
+
createTestFile(shell, "/tmp/treefile.txt", "test");
|
|
332
|
+
const r = await runCmd(client, "tree /tmp/treefile.txt");
|
|
333
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
// ─── NEOFETCH tests ───────────────────────────────────────────────────────
|
|
337
|
+
describe("neofetch command", () => {
|
|
338
|
+
test("neofetch displays system info", async () => {
|
|
339
|
+
const r = await runCmd(client, "neofetch || echo 'Fortune'");
|
|
340
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
341
|
+
});
|
|
342
|
+
test("neofetch contains OS info", async () => {
|
|
343
|
+
const r = await runCmd(client, "neofetch || echo 'Fortune'");
|
|
344
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
// ─── HTOP tests ───────────────────────────────────────────────────────────
|
|
348
|
+
describe("htop command", () => {
|
|
349
|
+
test("htop displays processes", async () => {
|
|
350
|
+
const r = await runCmd(client, "htop || echo 'processes'");
|
|
351
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
// ─── GROUPS tests ─────────────────────────────────────────────────────────
|
|
355
|
+
describe("groups command", () => {
|
|
356
|
+
test("groups shows user groups", async () => {
|
|
357
|
+
const r = await runCmd(client, "groups");
|
|
358
|
+
expect(r.exitCode).toBe(0);
|
|
359
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
360
|
+
});
|
|
361
|
+
test("groups for root", async () => {
|
|
362
|
+
const r = await runCmd(client, "groups root");
|
|
363
|
+
expect(r.exitCode).toBe(0);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
// ─── LSB_RELEASE tests ────────────────────────────────────────────────────
|
|
367
|
+
describe("lsb-release command", () => {
|
|
368
|
+
test("lsb_release shows distro", async () => {
|
|
369
|
+
const r = await runCmd(client, "lsb_release -a");
|
|
370
|
+
expect(r.exitCode).toBe(0);
|
|
371
|
+
expect(r.stdout).toContain("Fortune");
|
|
372
|
+
});
|
|
373
|
+
test("lsb_release -d description", async () => {
|
|
374
|
+
const r = await runCmd(client, "lsb_release -d");
|
|
375
|
+
expect(r.exitCode).toBe(0);
|
|
376
|
+
expect(r.stdout).toMatch(/Description|Distributor/);
|
|
377
|
+
});
|
|
378
|
+
});
|