(global: Global.Global)
| 39 | }; |
| 40 | |
| 41 | export function installErrorOnPrivate(global: Global.Global): void { |
| 42 | const jasmine = global.jasmine; |
| 43 | |
| 44 | for (const functionName of Object.keys( |
| 45 | disabledGlobals, |
| 46 | ) as Array<DisabledGlobalKeys>) { |
| 47 | global[functionName] = () => { |
| 48 | throwAtFunction(disabledGlobals[functionName], global[functionName]); |
| 49 | }; |
| 50 | } |
| 51 | |
| 52 | for (const methodName of Object.keys( |
| 53 | disabledJasmineMethods, |
| 54 | ) as Array<DisabledJasmineMethodsKeys>) { |
| 55 | // @ts-expect-error - void unallowd, but it throws 🤷 |
| 56 | jasmine[methodName] = () => { |
| 57 | throwAtFunction(disabledJasmineMethods[methodName], jasmine[methodName]); |
| 58 | }; |
| 59 | } |
| 60 | |
| 61 | function set() { |
| 62 | throwAtFunction( |
| 63 | 'Illegal usage of `jasmine.DEFAULT_TIMEOUT_INTERVAL`, prefer `jest.setTimeout`.', |
| 64 | set, |
| 65 | ); |
| 66 | } |
| 67 | |
| 68 | const original = jasmine.DEFAULT_TIMEOUT_INTERVAL; |
| 69 | |
| 70 | Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { |
| 71 | configurable: true, |
| 72 | enumerable: true, |
| 73 | get: () => original, |
| 74 | set, |
| 75 | }); |
| 76 | } |
| 77 | |
| 78 | function throwAtFunction( |
| 79 | message: string, |
no test coverage detected