-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path_constants.js
More file actions
96 lines (83 loc) · 3.17 KB
/
_constants.js
File metadata and controls
96 lines (83 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* @overview Provides values common to all tests.
* @license MIT
*/
import os from "node:os";
export const echoScript = "test/_echo.js";
export const isMacOS = os.platform() === "darwin";
export const isWindows = os.platform() === "win32";
export const isLinux = !isMacOS && !isWindows;
/* Illegal arguments */
export const illegalArguments = [
{ description: "null", value: null },
{ description: "undefined", value: undefined },
{ description: "toString is missing", value: { toString: null } },
{ description: "toString returns null", value: { toString: () => null } },
{ description: "toString returns a number", value: { toString: () => 42 } },
];
export const illegalArgumentLists = [
{ description: "not an array (null)", value: null },
{ description: "not an array (undefined)", value: undefined },
{ description: "not an array (number)", value: 42 },
{ description: "not an array (string)", value: "foobar" },
{ description: "not an array (object)", value: {} },
{ description: "object with map value", value: { map: "foobar" } },
{ description: "object with map function", value: { map: () => 42 } },
{ description: "typed array (uint8)", value: new Uint8Array() },
{ description: "typed array (uint16)", value: new Uint16Array() },
{ description: "typed array (uint32)", value: new Uint32Array() },
{ description: "typed array (uint64)", value: new BigUint64Array() },
{ description: "typed array (int8)", value: new Int8Array() },
{ description: "typed array (int16)", value: new Int16Array() },
{ description: "typed array (int32)", value: new Int32Array() },
{ description: "typed array (int64)", value: new BigInt64Array() },
{ description: "typed array (float32)", value: new Float32Array() },
{ description: "typed array (float64)", value: new Float64Array() },
{ description: "typed array (clamped)", value: new Uint8ClampedArray() },
];
if (Object.prototype.hasOwnProperty.call(globalThis, "Float16Array")) {
illegalArgumentLists.push({
description: "typed array (float16)",
value: new Float16Array(),
});
}
/* OS platforms (based on https://nodejs.org/api/os.html#osplatform) */
export const osAix = "aix";
export const osDarwin = "darwin";
export const osFreebsd = "freebsd";
export const osLinux = "linux";
export const osOpenbsd = "openbsd";
export const osSunos = "sunos";
export const osWin32 = "win32";
export const platforms = [
osAix,
osDarwin,
osFreebsd,
osLinux,
osOpenbsd,
osSunos,
osWin32,
];
/* OS types */
export const ostypeCygwin = "cygwin";
export const ostypeMsys = "msys";
export const osTypes = [ostypeCygwin, ostypeMsys];
/* Unix related constants */
export const binBash = "bash";
export const binBusyBox = "busybox";
export const binCsh = "csh";
export const binCshBsd = "bsd-csh";
export const binDash = "dash";
export const binZsh = "zsh";
export const shellsUnix = [binBash, binBusyBox, binCsh, binDash, binZsh];
/* Windows related constants */
export const binCmd = "cmd.exe";
export const binCmdNoExt = "cmd";
export const binPowerShell = "powershell.exe";
export const binPowerShellNoExt = "powershell";
export const shellsWindows = [
binCmd,
binCmdNoExt,
binPowerShell,
binPowerShellNoExt,
];