Skip to content

Commit

Permalink
use describeIf util
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 16, 2023
1 parent cad02f6 commit 9d3fd02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 2 additions & 10 deletions test/presets/vercel-edge.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { promises as fsp } from "node:fs";
import { resolve } from "pathe";
import { describe, it } from "vitest";
import { EdgeRuntime } from "edge-runtime";
import { isWindows } from "std-env";
import { setupTest, testNitro } from "../tests";
import { describeIf, setupTest, testNitro } from "../tests";

const describeIf = (condition, title, factory) =>
condition
? describe(title, factory)
: describe(title, () => {
it.skip("skipped", () => {});
});

describe.runIf(!isWindows)("nitro:preset:vercel-edge", async () => {
describeIf(!isWindows, "nitro:preset:vercel-edge", async () => {
const ctx = await setupTest("vercel-edge");
testNitro(ctx, async () => {
// TODO: Add add-event-listener
Expand Down
10 changes: 9 additions & 1 deletion test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolve } from "pathe";
import { listen, Listener } from "listhen";
import destr from "destr";
import { fetch, FetchOptions } from "ofetch";
import { expect, it, afterAll, beforeAll } from "vitest";
import { expect, it, afterAll, beforeAll, describe } from "vitest";
import { fileURLToPath } from "mlly";
import { joinURL } from "ufo";
import * as _nitro from "../src";
Expand All @@ -21,6 +21,14 @@ export interface Context {
isDev: boolean;
}

// https://github.com/unjs/nitro/pull/1240
export const describeIf = (condition, title, factory) =>
condition
? describe(title, factory)
: describe(title, () => {
it.skip("skipped", () => {});
});

export async function setupTest(preset: string) {
const fixtureDir = fileURLToPath(new URL("fixture", import.meta.url).href);

Expand Down

0 comments on commit 9d3fd02

Please sign in to comment.