( name: HookNames, fn: (this: T) => void | Promise<void>, )
| 822 | }; |
| 823 | |
| 824 | function addHook<T>( |
| 825 | name: HookNames, |
| 826 | fn: (this: T) => void | Promise<void>, |
| 827 | ) { |
| 828 | if (!TestSuiteInternal.current) { |
| 829 | if (TestSuiteInternal.started) { |
| 830 | throw new Error( |
| 831 | "Cannot add global hooks after a global test is registered", |
| 832 | ); |
| 833 | } |
| 834 | TestSuiteInternal.current = new TestSuiteInternal({ |
| 835 | name: "global", |
| 836 | [name]: fn, |
| 837 | }); |
| 838 | } else { |
| 839 | TestSuiteInternal.setHook(TestSuiteInternal.current!, name, fn); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | /** |
| 844 | * Run some shared setup before all of the tests in the group. |
no test coverage detected