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.
34 lines
1.1 KiB
34 lines
1.1 KiB
import { readFile } from "node:fs/promises" |
|
import { join } from "node:path" |
|
import { script } from "./shellcode/script" |
|
import { Bash, Fish, PowerShell, WinCmd, Zsh } from "./shellcode/shells" |
|
import testCwd from "./shellcode/test-cwd" |
|
import describe from "./describe" |
|
|
|
for (const shell of [Bash, Zsh, Fish, PowerShell, WinCmd]) { |
|
describe(shell, () => { |
|
test(`outputs json`, async () => { |
|
const filename = `file.json` |
|
await script(shell) |
|
.then( |
|
shell.redirectOutput(shell.call("fnm", ["env", "--json"]), { |
|
output: filename, |
|
}) |
|
) |
|
.takeSnapshot(shell) |
|
.execute(shell) |
|
|
|
if (shell.currentlySupported()) { |
|
const file = await readFile(join(testCwd(), filename), "utf8") |
|
expect(JSON.parse(file)).toEqual({ |
|
FNM_ARCH: expect.any(String), |
|
FNM_DIR: expect.any(String), |
|
FNM_LOGLEVEL: "info", |
|
FNM_MULTISHELL_PATH: expect.any(String), |
|
FNM_NODE_DIST_MIRROR: expect.any(String), |
|
FNM_VERSION_FILE_STRATEGY: "local", |
|
}) |
|
} |
|
}) |
|
}) |
|
}
|
|
|