From 7702f447d3cff90698c9a65cf0e17f9c363adf8d Mon Sep 17 00:00:00 2001 From: Jonas Amundsen Date: Tue, 3 Dec 2024 21:11:32 +0100 Subject: [PATCH] Unstuck mocha types See diff. --- lib/helpers/dry-run.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/helpers/dry-run.ts b/lib/helpers/dry-run.ts index 2729506a..120cca05 100644 --- a/lib/helpers/dry-run.ts +++ b/lib/helpers/dry-run.ts @@ -8,7 +8,14 @@ globalThis[globalPropertyName] = { afterEach: globalThis.afterEach, }; -window.before = () => {}; -window.beforeEach = () => {}; -window.after = () => {}; -window.afterEach = () => {}; +/** + * {} isn't strictly speaking a Mocha.Hook, so if Cypress decides to update their shipped Mocha + * version to v11, which introduces #5231 [1], then this might become problematic. The + * @types/mocha package did however update their types within its v10 line. + * + * [1] https://github.com/mochajs/mocha/issues/5231 + */ +window.before = () => ({}) as Mocha.Hook; +window.beforeEach = () => ({}) as Mocha.Hook; +window.after = () => ({}) as Mocha.Hook; +window.afterEach = () => ({}) as Mocha.Hook;