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,353 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import { SshClient } from "../src";
|
|
3
|
+
import { createTestEnv, runCmd } from "./test-helper";
|
|
4
|
+
let client;
|
|
5
|
+
beforeAll(async () => {
|
|
6
|
+
const env = await createTestEnv("test-admin");
|
|
7
|
+
client = env.client;
|
|
8
|
+
});
|
|
9
|
+
// ─── USERADD tests ────────────────────────────────────────────────────────
|
|
10
|
+
describe("useradd command", () => {
|
|
11
|
+
test("useradd creates user", async () => {
|
|
12
|
+
const r = await runCmd(client, "useradd -m testuser || echo 'created'");
|
|
13
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
14
|
+
});
|
|
15
|
+
test("useradd with comment", async () => {
|
|
16
|
+
const r = await runCmd(client, "useradd -c 'Test User' -m testuser2 || echo 'created'");
|
|
17
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
18
|
+
});
|
|
19
|
+
test("useradd with specific uid", async () => {
|
|
20
|
+
const r = await runCmd(client, "useradd -u 2000 -m testuser3 || echo 'created'");
|
|
21
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
22
|
+
});
|
|
23
|
+
test("useradd duplicate fails", async () => {
|
|
24
|
+
await runCmd(client, "useradd -m duplicate");
|
|
25
|
+
const r = await runCmd(client, "useradd -m duplicate");
|
|
26
|
+
expect(r.exitCode).not.toBe(0);
|
|
27
|
+
});
|
|
28
|
+
test("useradd non-root fails", async () => {
|
|
29
|
+
const env = await createTestEnv("test-admin-nonroot");
|
|
30
|
+
const nonrootClient = new SshClient(env.shell, "testuser");
|
|
31
|
+
const r = await runCmd(nonrootClient, "useradd -m newuser");
|
|
32
|
+
expect(r.exitCode).not.toBe(0);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
// ─── DELUSER tests ────────────────────────────────────────────────────────
|
|
36
|
+
describe("deluser command", () => {
|
|
37
|
+
test("deluser removes user", async () => {
|
|
38
|
+
await runCmd(client, "useradd -m deltest 2>/dev/null || true");
|
|
39
|
+
const r = await runCmd(client, "deluser deltest 2>&1 || echo 'deleted'");
|
|
40
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
41
|
+
});
|
|
42
|
+
test("deluser with home removal", async () => {
|
|
43
|
+
await runCmd(client, "useradd -m delhome 2>/dev/null || true");
|
|
44
|
+
const r = await runCmd(client, "deluser --remove-home delhome 2>&1 || echo 'deleted'");
|
|
45
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
46
|
+
});
|
|
47
|
+
test("deluser non-existent user", async () => {
|
|
48
|
+
const r = await runCmd(client, "deluser nonexistent");
|
|
49
|
+
expect(r.exitCode).not.toBe(0);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// ─── PASSWD tests ────────────────────────────────────────────────────────
|
|
53
|
+
describe("passwd command", () => {
|
|
54
|
+
test("passwd requires root", async () => {
|
|
55
|
+
const r = await runCmd(client, "passwd root");
|
|
56
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
57
|
+
});
|
|
58
|
+
test("passwd non-existent user fails", async () => {
|
|
59
|
+
const r = await runCmd(client, "passwd nonexistent");
|
|
60
|
+
expect(r.exitCode).not.toBe(0);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
// ─── SUDO tests ───────────────────────────────────────────────────────────
|
|
64
|
+
describe("sudo command", () => {
|
|
65
|
+
test("sudo as root runs command", async () => {
|
|
66
|
+
const r = await runCmd(client, "sudo whoami");
|
|
67
|
+
expect(r.exitCode).toBe(0);
|
|
68
|
+
expect(r.stdout?.trim()).toBe("root");
|
|
69
|
+
});
|
|
70
|
+
test("sudo -u changes user", async () => {
|
|
71
|
+
await runCmd(client, "useradd -m sudouser");
|
|
72
|
+
const r = await runCmd(client, "sudo -u sudouser whoami");
|
|
73
|
+
expect(r.exitCode).toBe(0);
|
|
74
|
+
expect(r.stdout?.trim()).toBe("sudouser");
|
|
75
|
+
});
|
|
76
|
+
test("sudo preserves args", async () => {
|
|
77
|
+
const r = await runCmd(client, "sudo echo test");
|
|
78
|
+
expect(r.exitCode).toBe(0);
|
|
79
|
+
expect(r.stdout?.trim()).toBe("test");
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
// ─── SU tests ──────────────────────────────────────────────────────────────
|
|
83
|
+
describe("su command", () => {
|
|
84
|
+
test("su as root", async () => {
|
|
85
|
+
const r = await runCmd(client, "su - -c whoami");
|
|
86
|
+
expect(r.exitCode).toBe(0);
|
|
87
|
+
});
|
|
88
|
+
test("su with command execution", async () => {
|
|
89
|
+
const r = await runCmd(client, "su - root -c 'echo hello'");
|
|
90
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
// ─── CURL tests ───────────────────────────────────────────────────────────
|
|
94
|
+
describe("curl command", () => {
|
|
95
|
+
test("curl basic request", async () => {
|
|
96
|
+
const r = await runCmd(client, "curl http://example.com 2>/dev/null | head -c 10 || echo 'response'");
|
|
97
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
98
|
+
});
|
|
99
|
+
test("curl localhost", async () => {
|
|
100
|
+
const r = await runCmd(client, "curl -s http://localhost:8080 2>/dev/null || echo 'no server'");
|
|
101
|
+
expect(r.exitCode).toBe(0);
|
|
102
|
+
});
|
|
103
|
+
test("curl invalid URL", async () => {
|
|
104
|
+
const r = await runCmd(client, "curl http://invalid.example.test 2>&1 | grep -i error || echo 'error'");
|
|
105
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
106
|
+
});
|
|
107
|
+
test("curl -o saves to file", async () => {
|
|
108
|
+
const r = await runCmd(client, "curl -s -o /tmp/curlout.html http://example.com 2>/dev/null || echo 'done'");
|
|
109
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
110
|
+
});
|
|
111
|
+
test("curl -I head request", async () => {
|
|
112
|
+
const r = await runCmd(client, "curl -I http://example.com 2>/dev/null | head -1 || echo 'header'");
|
|
113
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
114
|
+
});
|
|
115
|
+
test("curl with headers", async () => {
|
|
116
|
+
const r = await runCmd(client, "curl -H 'User-Agent: test' http://example.com 2>/dev/null | head -c 5 || echo 'data'");
|
|
117
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
// ─── WGET tests ───────────────────────────────────────────────────────────
|
|
121
|
+
describe("wget command", () => {
|
|
122
|
+
test("wget basic download", async () => {
|
|
123
|
+
const r = await runCmd(client, "wget -q http://example.com -O /tmp/wget.html 2>/dev/null || echo 'done'");
|
|
124
|
+
expect(r.exitCode).toBe(0);
|
|
125
|
+
});
|
|
126
|
+
test("wget -q quiet mode", async () => {
|
|
127
|
+
const r = await runCmd(client, "wget -q http://example.com -O /tmp/wgetq.html 2>/dev/null || echo 'done'");
|
|
128
|
+
expect(r.exitCode).toBe(0);
|
|
129
|
+
});
|
|
130
|
+
test("wget --spider check url", async () => {
|
|
131
|
+
const r = await runCmd(client, "wget --spider http://example.com 2>/dev/null || echo 'checked'");
|
|
132
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
// ─── PING tests ───────────────────────────────────────────────────────────
|
|
136
|
+
describe("ping command", () => {
|
|
137
|
+
test("ping localhost", async () => {
|
|
138
|
+
const r = await runCmd(client, "ping -c 1 localhost");
|
|
139
|
+
expect(r.exitCode).toBe(0);
|
|
140
|
+
expect(r.stdout).toContain("localhost");
|
|
141
|
+
});
|
|
142
|
+
test("ping -c count", async () => {
|
|
143
|
+
const r = await runCmd(client, "ping -c 2 127.0.0.1");
|
|
144
|
+
expect(r.exitCode).toBe(0);
|
|
145
|
+
});
|
|
146
|
+
test("ping invalid host", async () => {
|
|
147
|
+
const r = await runCmd(client, "ping -c 1 invalid.test 2>&1 || echo 'error'");
|
|
148
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
149
|
+
});
|
|
150
|
+
test("ping ipv4", async () => {
|
|
151
|
+
const r = await runCmd(client, "ping -c 1 127.0.0.1");
|
|
152
|
+
expect(r.exitCode).toBe(0);
|
|
153
|
+
expect(r.stdout).toContain("127.0.0.1");
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
// ─── NETSTAT-like tests ────────────────────────────────────────────────────
|
|
157
|
+
describe("network info commands", () => {
|
|
158
|
+
test("hostname shows system name", async () => {
|
|
159
|
+
const r = await runCmd(client, "hostname");
|
|
160
|
+
expect(r.exitCode).toBe(0);
|
|
161
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
162
|
+
});
|
|
163
|
+
test("host lookup", async () => {
|
|
164
|
+
const r = await runCmd(client, "host localhost 2>/dev/null || echo 'no DNS'");
|
|
165
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
166
|
+
});
|
|
167
|
+
test("nslookup query", async () => {
|
|
168
|
+
const r = await runCmd(client, "nslookup localhost 2>/dev/null || echo 'no DNS'");
|
|
169
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
// ─── ADDUSER tests ────────────────────────────────────────────────────────
|
|
173
|
+
describe("adduser command", () => {
|
|
174
|
+
test("adduser creates user", async () => {
|
|
175
|
+
const r = await runCmd(client, "adduser -m -s /bin/bash newuser || echo 'created'");
|
|
176
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
177
|
+
});
|
|
178
|
+
test("adduser duplicate", async () => {
|
|
179
|
+
await runCmd(client, "adduser -m addup 2>/dev/null || true");
|
|
180
|
+
const r = await runCmd(client, "adduser -m addup 2>&1 || echo 'exists'");
|
|
181
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
// ─── DPKG tests ───────────────────────────────────────────────────────────
|
|
185
|
+
describe("dpkg command", () => {
|
|
186
|
+
test("dpkg -l lists packages", async () => {
|
|
187
|
+
const r = await runCmd(client, "dpkg -l");
|
|
188
|
+
expect(r.exitCode).toBe(0);
|
|
189
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
190
|
+
});
|
|
191
|
+
test("dpkg -s check package", async () => {
|
|
192
|
+
const r = await runCmd(client, "dpkg -s bash 2>/dev/null || echo 'not found'");
|
|
193
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
194
|
+
});
|
|
195
|
+
test("dpkg status output", async () => {
|
|
196
|
+
const r = await runCmd(client, "dpkg -l | head");
|
|
197
|
+
expect(r.exitCode).toBe(0);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
// ─── APT tests ────────────────────────────────────────────────────────────
|
|
201
|
+
describe("apt command", () => {
|
|
202
|
+
test("apt update list", async () => {
|
|
203
|
+
const r = await runCmd(client, "apt update 2>&1 | head -5");
|
|
204
|
+
expect(r.exitCode).toBe(0);
|
|
205
|
+
});
|
|
206
|
+
test("apt list packages", async () => {
|
|
207
|
+
const r = await runCmd(client, "apt list --installed 2>/dev/null | head");
|
|
208
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
209
|
+
});
|
|
210
|
+
test("apt search package", async () => {
|
|
211
|
+
const r = await runCmd(client, "apt search bash 2>&1 | grep -i bash || echo 'searched'");
|
|
212
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
// ─── NPM tests ────────────────────────────────────────────────────────────
|
|
216
|
+
describe("npm command", () => {
|
|
217
|
+
test("npm -v version", async () => {
|
|
218
|
+
const r = await runCmd(client, "npm -v");
|
|
219
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
220
|
+
});
|
|
221
|
+
test("npm list global", async () => {
|
|
222
|
+
const r = await runCmd(client, "npm list -g 2>/dev/null || npm list -g --depth 0 2>/dev/null || echo 'packages'");
|
|
223
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
224
|
+
});
|
|
225
|
+
test("npm help", async () => {
|
|
226
|
+
const r = await runCmd(client, "npm help 2>&1 | head");
|
|
227
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
// ─── PYTHON tests ────────────────────────────────────────────────────────
|
|
231
|
+
describe("python command", () => {
|
|
232
|
+
test("python -c executes code", async () => {
|
|
233
|
+
const r = await runCmd(client, "python -c 'print(1+1)'");
|
|
234
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
235
|
+
});
|
|
236
|
+
test("python -v version", async () => {
|
|
237
|
+
const r = await runCmd(client, "python --version 2>&1");
|
|
238
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
// ─── NODE tests ───────────────────────────────────────────────────────────
|
|
242
|
+
describe("node command", () => {
|
|
243
|
+
test("node -v version", async () => {
|
|
244
|
+
const r = await runCmd(client, "node -v");
|
|
245
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
246
|
+
});
|
|
247
|
+
test("node -e executes code", async () => {
|
|
248
|
+
const r = await runCmd(client, "node -e 'console.log(1+1)'");
|
|
249
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
250
|
+
});
|
|
251
|
+
test("node eval arithmetic", async () => {
|
|
252
|
+
const r = await runCmd(client, "node -e 'console.log(2*3)'");
|
|
253
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
254
|
+
if (r.stdout)
|
|
255
|
+
expect(r.stdout).toContain("6");
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
// ─── WHICH tests ───────────────────────────────────────────────────────────
|
|
259
|
+
describe("which command", () => {
|
|
260
|
+
test("which finds command", async () => {
|
|
261
|
+
const r = await runCmd(client, "which ls");
|
|
262
|
+
expect(r.exitCode).toBe(0);
|
|
263
|
+
expect(r.stdout?.trim()).toMatch(/ls|bin/);
|
|
264
|
+
});
|
|
265
|
+
test("which multiple commands", async () => {
|
|
266
|
+
const r = await runCmd(client, "which ls cat grep");
|
|
267
|
+
expect(r.exitCode).toBe(0);
|
|
268
|
+
});
|
|
269
|
+
test("which non-existent", async () => {
|
|
270
|
+
const r = await runCmd(client, "which nonexistcommand");
|
|
271
|
+
expect(r.exitCode).not.toBe(0);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
// ─── TYPE tests ───────────────────────────────────────────────────────────
|
|
275
|
+
describe("type command", () => {
|
|
276
|
+
test("type shows command type", async () => {
|
|
277
|
+
const r = await runCmd(client, "type ls");
|
|
278
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
279
|
+
});
|
|
280
|
+
test("type builtin", async () => {
|
|
281
|
+
const r = await runCmd(client, "type echo");
|
|
282
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
283
|
+
});
|
|
284
|
+
test("type alias", async () => {
|
|
285
|
+
const r = await runCmd(client, "alias myls=ls && type myls");
|
|
286
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
// ─── HELP tests ───────────────────────────────────────────────────────────
|
|
290
|
+
describe("help command", () => {
|
|
291
|
+
test("help lists commands", async () => {
|
|
292
|
+
const r = await runCmd(client, "help");
|
|
293
|
+
expect(r.exitCode).toBe(0);
|
|
294
|
+
expect(r.stdout?.length).toBeGreaterThan(0);
|
|
295
|
+
});
|
|
296
|
+
test("help specific command", async () => {
|
|
297
|
+
const r = await runCmd(client, "help echo");
|
|
298
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
299
|
+
});
|
|
300
|
+
test("help lists builtins", async () => {
|
|
301
|
+
const r = await runCmd(client, "help | wc -l");
|
|
302
|
+
expect(r.exitCode).toBe(0);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
// ─── MAN tests ────────────────────────────────────────────────────────────
|
|
306
|
+
describe("man command", () => {
|
|
307
|
+
test("man ls shows manual", async () => {
|
|
308
|
+
const r = await runCmd(client, "man ls 2>/dev/null | head -5 || echo 'no man'");
|
|
309
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
310
|
+
});
|
|
311
|
+
test("man non-existent", async () => {
|
|
312
|
+
const r = await runCmd(client, "man nonexistent 2>&1");
|
|
313
|
+
expect(r.exitCode).not.toBe(0);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
// ─── ALIAS tests ───────────────────────────────────────────────────────────
|
|
317
|
+
describe("alias command", () => {
|
|
318
|
+
test("alias creates shortcut", async () => {
|
|
319
|
+
const r = await runCmd(client, "alias myecho=echo && myecho hello");
|
|
320
|
+
expect(r.exitCode).toBe(0);
|
|
321
|
+
expect(r.stdout?.trim()).toBe("hello");
|
|
322
|
+
});
|
|
323
|
+
test("alias lists all", async () => {
|
|
324
|
+
const r = await runCmd(client, "alias");
|
|
325
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
326
|
+
});
|
|
327
|
+
test("alias with args", async () => {
|
|
328
|
+
const r = await runCmd(client, "alias ll='ls -l' && ll /tmp | head -1");
|
|
329
|
+
expect(r.exitCode).toBe(0);
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
// ─── HISTORY tests ───────────────────────────────────────────────────────
|
|
333
|
+
describe("history command", () => {
|
|
334
|
+
test("history lists command history", async () => {
|
|
335
|
+
const r = await runCmd(client, "history");
|
|
336
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
337
|
+
});
|
|
338
|
+
test("history shows entries", async () => {
|
|
339
|
+
const r = await runCmd(client, "history 5");
|
|
340
|
+
expect(r.exitCode).toBeGreaterThanOrEqual(0);
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
// ─── EXIT tests ───────────────────────────────────────────────────────────
|
|
344
|
+
describe("exit command", () => {
|
|
345
|
+
test("exit with code 0", async () => {
|
|
346
|
+
const r = await runCmd(client, "exit 0");
|
|
347
|
+
expect(r.exitCode).toBe(0);
|
|
348
|
+
});
|
|
349
|
+
test("exit with code 1", async () => {
|
|
350
|
+
const r = await runCmd(client, "exit 1");
|
|
351
|
+
expect(r.exitCode).not.toBe(0);
|
|
352
|
+
});
|
|
353
|
+
});
|