(fn: Function, hook: SuiteHook, suiteError: Error | undefined)
| 594 | } |
| 595 | |
| 596 | function validateSuiteHook(fn: Function, hook: SuiteHook, suiteError: Error | undefined) { |
| 597 | const usedProps = getUsedProps(fn, { sourceError: suiteError, suiteHook: hook }) |
| 598 | if (usedProps.size) { |
| 599 | const error = new FixtureAccessError( |
| 600 | `The ${hook} hook uses fixtures "${[...usedProps].join('", "')}", but has no access to context. ` |
| 601 | + `Did you forget to call it as "test.${hook}()" instead of "${hook}()"?\n` |
| 602 | + `If you used internal "suite" task as the first argument previously, access it in the second argument instead. ` |
| 603 | + `See https://vitest.dev/guide/test-context#suite-level-hooks`, |
| 604 | ) |
| 605 | if (suiteError) { |
| 606 | error.stack = suiteError.stack?.replace(suiteError.message, error.message) |
| 607 | } |
| 608 | throw error |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | const kPropsSymbol = Symbol('$vitest:fixture-props') |
| 613 | const kPropNamesSymbol = Symbol('$vitest:fixture-prop-names') |
no test coverage detected