Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Use data-driven testing across **all 5 routing universes**:

```typescript
// Import the complete universe definitions
import { ROUTING_UNIVERSES } from "../testing/test-utils.js";
import { ROUTING_UNIVERSES } from "$test/test-utils.js";

ROUTING_UNIVERSES.forEach((ru) => {
describe(`Component - ${ru.text}`, () => {
Expand Down Expand Up @@ -741,7 +741,7 @@ test("Should react to state changes.", () => {
For testing components that rely on `window.location` and `window.history` (like `RouterEngine`), use the comprehensive browser mocking utilities:

```typescript
import { setupBrowserMocks } from "../testing/test-utils.js";
import { setupBrowserMocks } from "$test/test-utils.js";

describe("Component requiring browser APIs", () => {
beforeEach(() => {
Expand Down Expand Up @@ -807,7 +807,7 @@ Refer to `src/testing/test-utils.ts` for complete function signatures and type d
**Complete test coverage across all 5 routing universes** using the standardized pattern:

```typescript
import { ROUTING_UNIVERSES } from "../testing/test-utils.js";
import { ROUTING_UNIVERSES } from "$test/test-utils.js";

// ✅ Recommended: Test ALL universes with single loop
ROUTING_UNIVERSES.forEach((universe) => {
Expand Down Expand Up @@ -856,7 +856,7 @@ Use dictionary-based constants for better maintainability:

```typescript
// Import self-documenting hash values
import { ALL_HASHES } from "../testing/test-utils.js";
import { ALL_HASHES } from "$test/test-utils.js";

// Usage in tests
test("Should validate hash compatibility.", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Fallback/Fallback.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { init } from "$lib/init.js";
import { describe, test, expect, beforeAll, afterAll, beforeEach } from "vitest";
import { render } from "@testing-library/svelte";
import Fallback from "./Fallback.svelte";
import { addMatchingRoute, addRoutes, createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
import { addMatchingRoute, addRoutes, createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";
import { flushSync } from "svelte";
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
import type { ExtendedRoutingOptions } from "$lib/types.js";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Link/Link.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { location } from "$lib/kernel/Location.js";
import { describe, test, expect, beforeAll, afterAll, beforeEach, vi, afterEach } from "vitest";
import { render, fireEvent } from "@testing-library/svelte";
import Link from "./Link.svelte";
import { createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES, createWindowMock, setupBrowserMocks, type RoutingUniverse, addMatchingRoute } from "../../testing/test-utils.js";
import { createRouterTestSetup, createTestSnippet, ROUTING_UNIVERSES, ALL_HASHES, createWindowMock, setupBrowserMocks, type RoutingUniverse, addMatchingRoute } from "$test/test-utils.js";
import { flushSync } from "svelte";
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
import type { ExtendedRoutingOptions } from "$lib/types.js";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/LinkContext/LinkContext.svelte.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, test, expect, vi, afterEach } from "vitest";
import { render } from "@testing-library/svelte";
import { linkCtxKey, type ILinkContext } from "./LinkContext.svelte";
import TestLinkContextWithContextSpy from "../../testing/TestLinkContextWithContextSpy.svelte";
import TestLinkContextWithContextSpy from "$test/TestLinkContextWithContextSpy.svelte";
import { flushSync } from "svelte";
import type { ActiveStateAriaAttributes } from "$lib/types.js";

Expand Down
4 changes: 2 additions & 2 deletions src/lib/Route/Route.svelte.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, test, expect, beforeEach, vi, beforeAll, afterAll, afterEach } from "vitest";
import { render } from "@testing-library/svelte";
import Route from "./Route.svelte";
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";
import { init } from "$lib/init.js";
import { location } from "$lib/kernel/Location.js";
import TestRouteWithRouter from "../../testing/TestRouteWithRouter.svelte";
import TestRouteWithRouter from "$test/TestRouteWithRouter.svelte";
import { resetRoutingOptions, setRoutingOptions } from "$lib/kernel/options.js";
import type { ExtendedRoutingOptions, InitOptions } from "$lib/types.js";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Router/Router.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test, expect, beforeEach, vi, beforeAll, afterAll } from "vit
import { render } from "@testing-library/svelte";
import Router, { getRouterContextKey } from "./Router.svelte";
import { RouterEngine } from "$lib/kernel/RouterEngine.svelte.js";
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES } from "../../testing/test-utils.js";
import { createTestSnippet, createRouterTestSetup, ROUTING_UNIVERSES } from "$test/test-utils.js";
import { flushSync } from "svelte";
import { init } from "$lib/init.js";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/behaviors/active.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { activeBehavior } from "./active.svelte.js";
import { RouterEngine } from "$lib/kernel/RouterEngine.svelte.js";
import type { ActiveState, RouteStatus } from "$lib/types.js";
import { render } from "@testing-library/svelte";
import TestActiveBehavior from "../../testing/TestActiveBehavior.svelte";
import TestActiveBehavior from "$test/TestActiveBehavior.svelte";
import { flushSync } from "svelte";
import type { ClassValue } from "svelte/elements";
import { clsx } from "clsx";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/InterceptedHistoryApi.svelte.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
import { InterceptedHistoryApi } from "./InterceptedHistoryApi.svelte.js";
import type { State, BeforeNavigateEvent } from "../types.js";
import { setupBrowserMocks } from "../../testing/test-utils.js";
import { setupBrowserMocks } from "$test/test-utils.js";

describe("InterceptedHistoryApi", () => {
const initialUrl = "http://example.com/";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/LocationFull.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { LocationFull } from "./LocationFull.js";
import type { State, Location, FullModeHistoryApi } from "../types.js";
import { setupBrowserMocks, ALL_HASHES } from "../../testing/test-utils.js";
import { setupBrowserMocks, ALL_HASHES } from "$test/test-utils.js";
import { SvelteURL } from "svelte/reactivity";

describe("LocationFull", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/LocationLite.svelte.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
import { LocationLite } from "./LocationLite.svelte.js";
import type { ExtendedRoutingOptions, Hash, HistoryApi, PreserveQuery } from "../types.js";
import { setupBrowserMocks, ALL_HASHES } from "../../testing/test-utils.js";
import { setupBrowserMocks, ALL_HASHES } from "$test/test-utils.js";
import { SvelteURL } from "svelte/reactivity";
import { setLocation } from "./Location.js";
import { resetRoutingOptions, setRoutingOptions } from "./options.js";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/RouterEngine.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { init } from "../init.js";
import { registerRouter } from "./trace.svelte.js";
import { location } from "./Location.js";
import type { State, RouteInfo, ExtendedRoutingOptions } from "../types.js";
import { setupBrowserMocks, addRoutes, ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
import { setupBrowserMocks, addRoutes, ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";
import { resetRoutingOptions, setRoutingOptions } from "./options.js";

describe("RouterEngine", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/StockHistoryApi.svelte.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
import { StockHistoryApi } from "./StockHistoryApi.svelte.js";
import { setupBrowserMocks } from "../../testing/test-utils.js";
import { setupBrowserMocks } from "$test/test-utils.js";

describe("StockHistoryApi", () => {
const initialUrl = "http://example.com/";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/calculateHref.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test, expect, beforeAll, afterAll, beforeEach } from "vitest"
import { calculateHref, type CalculateHrefOptions } from "./calculateHref.js";
import { init } from "../init.js";
import { location } from "./Location.js";
import { ROUTING_UNIVERSES, ALL_HASHES } from "../../testing/test-utils.js";
import { ROUTING_UNIVERSES, ALL_HASHES } from "$test/test-utils.js";

describe("calculateHref", () => {
describe("(...paths) Overload", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel/calculateState.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { init } from '../init.js';
import { describe, test, expect, beforeAll, afterAll, beforeEach } from 'vitest';
import { calculateState } from './calculateState.js';
import { ROUTING_UNIVERSES, ALL_HASHES, setupBrowserMocks } from '../../testing/test-utils.js';
import { ROUTING_UNIVERSES, ALL_HASHES, setupBrowserMocks } from '$test/test-utils.js';

describe('calculateState', () => {
describe('Clean Slate (no existing state)', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, test, vi } from "vitest";
import { assertAllowedRoutingMode, expandAriaAttributes } from "./utils.js";
import { ALL_HASHES } from "../testing/test-utils.js";
import { ALL_HASHES } from "$test/test-utils.js";
import { resetRoutingOptions, setRoutingOptions } from "./kernel/options.js";
import type { ActiveStateAriaAttributes, ExtendedRoutingOptions, Hash } from "./types.js";
import type { AriaAttributes } from "svelte/elements";
Expand Down
5 changes: 4 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const config = {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
adapter: adapter(),
alias: {
$test: 'src/testing'
}
}
};

Expand Down