The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
run these tests only on CI
Kiran Kbb99e4d63d39
diff --git a/apps/web/tests/analytics/browser.test.ts b/apps/web/tests/analytics/browser.test.tsindex 025a731f42..52d604a8f5 100644--- a/apps/web/tests/analytics/browser.test.ts+++ b/apps/web/tests/analytics/browser.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/browser", async (ctx) => {+test.runIf(env.CI)("GET /analytics/browser", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/city.test.ts b/apps/web/tests/analytics/city.test.tsindex 7e14be193a..fb2348ad4f 100644--- a/apps/web/tests/analytics/city.test.ts+++ b/apps/web/tests/analytics/city.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/city", async (ctx) => {+test.runIf(env.CI)("GET /analytics/city", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/clicks.test.ts b/apps/web/tests/analytics/clicks.test.tsindex 4cf1217a13..d17882dbc7 100644--- a/apps/web/tests/analytics/clicks.test.ts+++ b/apps/web/tests/analytics/clicks.test.ts@@ -1,7 +1,8 @@import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/clicks", async (ctx) => {+test.runIf(env.CI)("GET /analytics/clicks", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/country.test.ts b/apps/web/tests/analytics/country.test.tsindex ed167f1e0c..9d11983710 100644--- a/apps/web/tests/analytics/country.test.ts+++ b/apps/web/tests/analytics/country.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/country", async (ctx) => {+test.runIf(env.CI)("GET /analytics/country", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/device.test.ts b/apps/web/tests/analytics/device.test.tsindex 8419640cd9..c625425eec 100644--- a/apps/web/tests/analytics/device.test.ts+++ b/apps/web/tests/analytics/device.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/device", async (ctx) => {+test.runIf(env.CI)("GET /analytics/device", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/os.test.ts b/apps/web/tests/analytics/os.test.tsindex 2d3c2bd9fa..d8ee04da7b 100644--- a/apps/web/tests/analytics/os.test.ts+++ b/apps/web/tests/analytics/os.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/os", async (ctx) => {+test.runIf(env.CI)("GET /analytics/os", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/referer.test.ts b/apps/web/tests/analytics/referer.test.tsindex d57e4416fe..8afb096b56 100644--- a/apps/web/tests/analytics/referer.test.ts+++ b/apps/web/tests/analytics/referer.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/referer", async (ctx) => {+test.runIf(env.CI)("GET /analytics/referer", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/timeseries.test.ts b/apps/web/tests/analytics/timeseries.test.tsindex f9d391677d..05ba797f06 100644--- a/apps/web/tests/analytics/timeseries.test.ts+++ b/apps/web/tests/analytics/timeseries.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/timeseries", async (ctx) => {+test.runIf(env.CI)("GET /analytics/timeseries", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/top-links.test.ts b/apps/web/tests/analytics/top-links.test.tsindex 5c18148d6b..cd5de89933 100644--- a/apps/web/tests/analytics/top-links.test.ts+++ b/apps/web/tests/analytics/top-links.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/top_links", async (ctx) => {+test.runIf(env.CI)("GET /analytics/top_links", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/analytics/top-urls.test.ts b/apps/web/tests/analytics/top-urls.test.tsindex 5b992e72c9..184298cff6 100644--- a/apps/web/tests/analytics/top-urls.test.ts+++ b/apps/web/tests/analytics/top-urls.test.ts@@ -1,9 +1,10 @@import z from "@/lib/zod";import { analyticsResponseSchema } from "@/lib/zod/schemas";import { expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";-test("GET /analytics/top_urls", async (ctx) => {+test.runIf(env.CI)("GET /analytics/top_urls", async (ctx) => {const h = new IntegrationHarness(ctx);const { workspace, http } = await h.init();const { workspaceId } = workspace;diff --git a/apps/web/tests/redirects/index.test.ts b/apps/web/tests/redirects/index.test.tsindex f216c29bdc..648ece29c1 100644--- a/apps/web/tests/redirects/index.test.ts+++ b/apps/web/tests/redirects/index.test.ts@@ -1,4 +1,5 @@import { describe, expect, test } from "vitest";+import { env } from "../utils/env";import { IntegrationHarness } from "../utils/integration";const poweredBy = "Dub.co - Link management for modern marketing teams";@@ -10,7 +11,7 @@ const fetchOptions: RequestInit = {},};-describe.sequential("Link Redirects", async () => {+describe.runIf(env.CI)("Link Redirects", async () => {const h = new IntegrationHarness();test("root", async () => {diff --git a/apps/web/tests/utils/env.ts b/apps/web/tests/utils/env.tsindex a309ac9b96..09177b2938 100644--- a/apps/web/tests/utils/env.ts+++ b/apps/web/tests/utils/env.ts@@ -7,4 +7,7 @@ export const integrationTestEnv = z.object({E2E_WORKSPACE_ID: z.string().min(1),E2E_WORKSPACE_SLUG: z.string().min(1),E2E_WORKSPACE_NAME: z.string().min(1),+ CI: z.boolean().default(false), // true if running in CI});++export const env = integrationTestEnv.parse(process.env);diff --git a/apps/web/tests/utils/integration.ts b/apps/web/tests/utils/integration.tsindex 42fc5471d8..18538c6446 100644--- a/apps/web/tests/utils/integration.ts+++ b/apps/web/tests/utils/integration.ts@@ -2,7 +2,7 @@ import { Project, User } from "@prisma/client";import { type TaskContext } from "vitest";import { z } from "zod";import { HttpClient } from "../utils/http";-import { integrationTestEnv } from "./env";+import { env, integrationTestEnv } from "./env";interface Resources {user: Pick<User, "id">;@@ -18,8 +18,7 @@ export class IntegrationHarness {public http: HttpClient;constructor(ctx?: TaskContext) {- this.env = integrationTestEnv.parse(process.env);-+ this.env = env;this.ctx = ctx;this.baseUrl = this.env.E2E_BASE_URL;this.http = new HttpClient({