Skip to content

Commit eb2e910

Browse files
refactor(tests): refactor expected globals test (#262)
1 parent 2f3c4df commit eb2e910

File tree

1 file changed

+107
-1
lines changed

1 file changed

+107
-1
lines changed

test/builtins/globals.js

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,117 @@ export const source = `
66
}
77
`;
88

9+
const EXPECTED_GLOBALS = [
10+
'undefined',
11+
'Function',
12+
'Object',
13+
'eval',
14+
'globalThis',
15+
'Array',
16+
'Boolean',
17+
'JSON',
18+
'Date',
19+
'Math',
20+
'isNaN',
21+
'isFinite',
22+
'parseInt',
23+
'parseFloat',
24+
'NaN',
25+
'Infinity',
26+
'Number',
27+
'escape',
28+
'unescape',
29+
'decodeURI',
30+
'encodeURI',
31+
'decodeURIComponent',
32+
'encodeURIComponent',
33+
'String',
34+
'RegExp',
35+
'Error',
36+
'InternalError',
37+
'AggregateError',
38+
'EvalError',
39+
'RangeError',
40+
'ReferenceError',
41+
'SyntaxError',
42+
'TypeError',
43+
'URIError',
44+
'ArrayBuffer',
45+
'Int8Array',
46+
'Uint8Array',
47+
'Int16Array',
48+
'Uint16Array',
49+
'Int32Array',
50+
'Uint32Array',
51+
'Float32Array',
52+
'Float64Array',
53+
'Uint8ClampedArray',
54+
'BigInt64Array',
55+
'BigUint64Array',
56+
'Float16Array',
57+
'BigInt',
58+
'Proxy',
59+
'WeakMap',
60+
'Map',
61+
'Set',
62+
'DataView',
63+
'Symbol',
64+
'Reflect',
65+
'WeakSet',
66+
'Promise',
67+
'FinalizationRegistry',
68+
'WeakRef',
69+
'ReadableStream',
70+
'ReadableStreamBYOBReader',
71+
'ReadableStreamBYOBRequest',
72+
'ReadableStreamDefaultReader',
73+
'ReadableStreamDefaultController',
74+
'ReadableByteStreamController',
75+
'WritableStream',
76+
'ByteLengthQueuingStrategy',
77+
'CountQueuingStrategy',
78+
'self',
79+
'queueMicrotask',
80+
'structuredClone',
81+
'atob',
82+
'btoa',
83+
'Blob',
84+
'File',
85+
'FormData',
86+
'MultipartFormData',
87+
'DOMException',
88+
'URL',
89+
'URLSearchParams',
90+
'console',
91+
'Performance',
92+
'performance',
93+
'setInterval',
94+
'setTimeout',
95+
'clearInterval',
96+
'clearTimeout',
97+
'WorkerLocation',
98+
'location',
99+
'TextEncoder',
100+
'TextDecoder',
101+
'TransformStream',
102+
'CompressionStream',
103+
'DecompressionStream',
104+
'fetch',
105+
'Request',
106+
'Response',
107+
'Headers',
108+
'addEventListener',
109+
'SubtleCrypto',
110+
'Crypto',
111+
'crypto',
112+
'CryptoKey',
113+
];
114+
9115
export async function test(run) {
10116
const { stdout, stderr } = await run();
11117
strictEqual(
12118
stdout,
13-
`["undefined", "Function", "Object", "eval", "globalThis", "Array", "Boolean", "JSON", "Date", "Math", "isNaN", "isFinite", "parseInt", "parseFloat", "NaN", "Infinity", "Number", "escape", "unescape", "decodeURI", "encodeURI", "decodeURIComponent", "encodeURIComponent", "String", "RegExp", "Error", "InternalError", "AggregateError", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "ArrayBuffer", "Int8Array", "Uint8Array", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "Uint8ClampedArray", "BigInt64Array", "BigUint64Array", "Float16Array", "BigInt", "Proxy", "WeakMap", "Map", "Set", "DataView", "Symbol", "Reflect", "WeakSet", "Promise", "FinalizationRegistry", "WeakRef", "ReadableStream", "ReadableStreamBYOBReader", "ReadableStreamBYOBRequest", "ReadableStreamDefaultReader", "ReadableStreamDefaultController", "ReadableByteStreamController", "WritableStream", "ByteLengthQueuingStrategy", "CountQueuingStrategy", "self", "queueMicrotask", "structuredClone", "atob", "btoa", "Blob", "File", "FormData", "MultipartFormData", "DOMException", "URL", "URLSearchParams", "console", "Performance", "performance", "setInterval", "setTimeout", "clearInterval", "clearTimeout", "WorkerLocation", "location", "TextEncoder", "TextDecoder", "TransformStream", "CompressionStream", "DecompressionStream", "fetch", "Request", "Response", "Headers", "addEventListener", "SubtleCrypto", "Crypto", "crypto", "CryptoKey"]\n`
119+
'[' + EXPECTED_GLOBALS.map((v) => `"${v}"`).join(', ') + ']\n',
14120
);
15121
strictEqual(stderr, '');
16122
}

0 commit comments

Comments
 (0)