From d5844cf27d750268332dbc18993c47ff1b453d9b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 29 Feb 2024 12:23:00 +0100 Subject: [PATCH] fix: disable scheduled tasks in testing environment --- src/runtime/task.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/task.ts b/src/runtime/task.ts index 90b8be65f4..5e1239b495 100644 --- a/src/runtime/task.ts +++ b/src/runtime/task.ts @@ -1,5 +1,6 @@ import { createError } from "h3"; import { Cron } from "croner"; +import { isTest } from "std-env"; import { tasks, scheduledTasks } from "#internal/nitro/virtual/tasks"; type MaybePromise = T | Promise; @@ -88,7 +89,7 @@ export async function runTask( /** @experimental */ export function startScheduleRunner() { - if (!scheduledTasks || scheduledTasks.length === 0) { + if (!scheduledTasks || scheduledTasks.length === 0 || isTest) { return; }