Skip to content

Commit

Permalink
fix: disable scheduled tasks in testing environment (#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 29, 2024
1 parent eeca6e8 commit ed8a3db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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> = T | Promise<T>;
Expand Down Expand Up @@ -88,7 +89,7 @@ export async function runTask<RT = unknown>(

/** @experimental */
export function startScheduleRunner() {
if (!scheduledTasks || scheduledTasks.length === 0) {
if (!scheduledTasks || scheduledTasks.length === 0 || isTest) {
return;
}

Expand Down

0 comments on commit ed8a3db

Please sign in to comment.