You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.8 KiB
71 lines
1.8 KiB
import { script } from "./shellcode/script.js" |
|
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells.js" |
|
import describe from "./describe.js" |
|
import getStderr from "./shellcode/get-stderr.js" |
|
|
|
for (const shell of [Bash, Zsh, Fish, PowerShell]) { |
|
describe(shell, () => { |
|
test(`"quiet" log level`, async () => { |
|
await script(shell) |
|
.then(shell.env({ logLevel: "quiet" })) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["install", "v8.11.3"]), |
|
"", |
|
"fnm install" |
|
) |
|
) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["use", "v8.11.3"]), |
|
"", |
|
"fnm use" |
|
) |
|
) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["alias", "v8.11.3", "something"]), |
|
"", |
|
"fnm alias" |
|
) |
|
) |
|
.takeSnapshot(shell) |
|
.execute(shell) |
|
}) |
|
|
|
test("error log level", async () => { |
|
await script(shell) |
|
.then(shell.env({ logLevel: "error" })) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["install", "v8.11.3"]), |
|
"", |
|
"fnm install" |
|
) |
|
) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["use", "v8.11.3"]), |
|
"", |
|
"fnm use" |
|
) |
|
) |
|
.then( |
|
shell.hasCommandOutput( |
|
shell.call("fnm", ["alias", "v8.11.3", "something"]), |
|
"", |
|
"fnm alias" |
|
) |
|
) |
|
.then( |
|
shell.scriptOutputContains( |
|
getStderr(shell.call("fnm", ["alias", "abcd", "efg"])), |
|
`"find requested version"` |
|
) |
|
) |
|
|
|
.takeSnapshot(shell) |
|
.execute(shell) |
|
}) |
|
}) |
|
}
|
|
|