refactor(fsd): consolidate src/lib into shared, move test setup to shared/config/tests

This commit is contained in:
Ilia Mashkov
2026-03-07 10:55:57 +03:00
parent ef9d97dde0
commit 45e3ef77c6
11 changed files with 15 additions and 32 deletions

View File

@@ -1,7 +1,8 @@
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./src/tests/e2e",
testDir: "./src",
testMatch: "**/*.e2e.{ts,js}",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
@@ -26,7 +27,7 @@ export default defineConfig({
},
],
webServer: {
command: "npm run build && npm run preview",
command: "bun run build && bun run preview",
port: 4173,
},
});

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import '../../app.css';
import favicon from '$lib/assets/favicon.svg';
import favicon from '$shared/assets/favicon.svg';
let { children } = $props();
</script>

View File

@@ -1 +0,0 @@
// place files you want to import through the `$lib` alias in this folder.

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,4 +1,4 @@
import { expect, afterEach } from 'vitest';
import { afterEach } from 'vitest';
import { cleanup } from '@testing-library/svelte';
afterEach(() => {

View File

@@ -1,11 +0,0 @@
import { describe, it, expect } from 'vitest';
describe('Basic tests', () => {
it('should add numbers correctly', () => {
expect(1 + 1).toBe(2);
});
it('should subtract numbers correctly', () => {
expect(5 - 3).toBe(2);
});
});

View File

@@ -1,6 +0,0 @@
import { test, expect } from '@playwright/test';
test('homepage loads correctly', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/allmywork/);
});

View File

@@ -13,7 +13,7 @@ const config = {
routes: "src/app/routes",
},
alias: {
$lib: path.resolve("src/lib"),
$lib: path.resolve("src/shared/lib"),
$shared: path.resolve("src/shared"),
$pages: path.resolve("src/pages"),
$features: path.resolve("src/features"),

View File

@@ -6,7 +6,7 @@ export default defineConfig({
plugins: [sveltekit()],
resolve: {
alias: {
$lib: path.resolve("./src/lib"),
$lib: path.resolve("./src/shared/lib"),
},
},
});

View File

@@ -20,9 +20,9 @@ export default defineConfig({
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/tests/setup.ts"],
include: ["src/**/*.{test,spec}.{js,ts}"],
exclude: ["src/tests/e2e/**/*.{test,spec}.{js,ts}"],
setupFiles: ["./src/shared/config/tests/setup.ts"],
include: ["src/**/*.test.{js,ts}"],
exclude: ["src/**/*.e2e.{js,ts}"],
projects: [
{
extends: true,
@@ -52,7 +52,7 @@ export default defineConfig({
},
resolve: {
alias: {
$lib: path.resolve("./src/lib"),
$lib: path.resolve("./src/shared/lib"),
$shared: path.resolve("./src/shared"),
$pages: path.resolve("./src/pages"),
$features: path.resolve("./src/features"),

View File

@@ -17,13 +17,13 @@ export default defineConfig({
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/tests/setup.ts"],
include: ["src/**/*.{test,spec}.{js,ts}"],
exclude: ["src/tests/e2e/**/*.{test,spec}.{js,ts}"],
setupFiles: ["./src/shared/config/tests/setup.ts"],
include: ["src/**/*.test.{js,ts}"],
exclude: ["src/**/*.e2e.{js,ts}"],
},
resolve: {
alias: {
$lib: path.resolve("./src/lib"),
$lib: path.resolve("./src/shared/lib"),
$shared: path.resolve("./src/shared"),
$pages: path.resolve("./src/pages"),
$features: path.resolve("./src/features"),