2020-01-16 19:42:58 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-06 21:45:39 -04:00
|
|
|
|
2020-04-27 19:06:03 -04:00
|
|
|
export const internalSymbol = Symbol("Deno.internal");
|
2020-01-16 19:42:58 -05:00
|
|
|
|
|
|
|
// The object where all the internal fields for testing will be living.
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2020-07-06 21:45:39 -04:00
|
|
|
export const internalObject: Record<string, any> = {};
|
2020-01-16 19:42:58 -05:00
|
|
|
|
|
|
|
// Register a field to internalObject for test access,
|
2020-04-27 19:06:03 -04:00
|
|
|
// through Deno[Deno.internal][name].
|
2020-01-16 19:42:58 -05:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
export function exposeForTest(name: string, value: any): void {
|
|
|
|
Object.defineProperty(internalObject, name, {
|
|
|
|
value,
|
2020-03-28 13:03:49 -04:00
|
|
|
enumerable: false,
|
2020-01-16 19:42:58 -05:00
|
|
|
});
|
|
|
|
}
|