* @param {string} name * @return {!Function} * @throws {TypeError}
(name)
| 535 | * @throws {TypeError} |
| 536 | */ |
| 537 | function getTestHook(name) { |
| 538 | let fn = global[name] |
| 539 | let type = typeof fn |
| 540 | if (type !== 'function') { |
| 541 | throw TypeError( |
| 542 | `Expected global.${name} to be a function, but is ${type}.` + |
| 543 | ' This can happen if you try using this module when running with' + |
| 544 | ' node directly instead of using jasmine or mocha', |
| 545 | ) |
| 546 | } |
| 547 | return fn |
| 548 | } |
| 549 | |
| 550 | function locate(fileLike) { |
| 551 | if (fs.existsSync(fileLike)) { |