@aamini/config 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{playwright.shared.config.d.mts → playwright.d.mts} +2 -3
- package/dist/{playwright.shared.config.mjs → playwright.mjs} +2 -3
- package/dist/playwright.mjs.map +1 -0
- package/dist/setup/styles.mjs +0 -1
- package/dist/test/browser.d.mts +7 -2
- package/dist/test/browser.mjs +5 -3
- package/dist/test/browser.mjs.map +1 -1
- package/dist/test/db.d.mts +34 -7
- package/dist/test/db.mjs +29 -15
- package/dist/test/db.mjs.map +1 -1
- package/dist/test/server.d.mts +7 -3
- package/dist/test/server.mjs +3 -4
- package/dist/test/server.mjs.map +1 -1
- package/dist/vite.d.mts +81 -0
- package/dist/vite.mjs +211 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +43 -47
- package/tsconfig/tsconfig.tanstack.json +1 -1
- package/dist/internal-Dshd0hdM.mjs +0 -22
- package/dist/internal-Dshd0hdM.mjs.map +0 -1
- package/dist/playwright.shared.config.mjs.map +0 -1
- package/dist/test/database.d.mts +0 -22
- package/dist/test/database.mjs +0 -18
- package/dist/test/database.mjs.map +0 -1
- package/dist/test/playwright.d.mts +0 -7
- package/dist/test/playwright.mjs +0 -15
- package/dist/test/playwright.mjs.map +0 -1
- package/dist/test/postgres.d.mts +0 -14
- package/dist/test/postgres.mjs +0 -25
- package/dist/test/postgres.mjs.map +0 -1
- package/dist/test/visual-page.d.mts +0 -36
- package/dist/test/visual-page.mjs +0 -30
- package/dist/test/visual-page.mjs.map +0 -1
- package/dist/vite.shared.d.mts +0 -379
- package/dist/vite.shared.mjs +0 -302
- package/dist/vite.shared.mjs.map +0 -1
- package/dist/vitest.shared.d.mts +0 -12
- package/dist/vitest.shared.mjs +0 -122
- package/dist/vitest.shared.mjs.map +0 -1
- package/msw.ts +0 -5
- package/playwright.shared.config.ts +0 -71
- package/setup/styles.ts +0 -4
- package/test/browser.ts +0 -44
- package/test/database.ts +0 -38
- package/test/db.ts +0 -86
- package/test/internal.ts +0 -45
- package/test/playwright.ts +0 -17
- package/test/postgres.ts +0 -43
- package/test/server.ts +0 -43
- package/test/visual-page.ts +0 -57
- package/tsconfig/tsconfig.astro.json +0 -34
- package/tsconfig/tsconfig.react.json +0 -16
- package/virtual-modules.d.ts +0 -6
- package/vite.config.ts +0 -53
- package/vite.shared.ts +0 -411
- package/vitest.shared.ts +0 -183
package/package.json
CHANGED
|
@@ -1,65 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aamini/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/aria-amini/toolkit",
|
|
9
9
|
"directory": "packages/config"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/aria-amini/toolkit/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/aria-amini/toolkit/tree/main/packages/config#readme",
|
|
12
15
|
"publishConfig": {
|
|
13
16
|
"access": "public"
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"dist",
|
|
17
|
-
"setup",
|
|
18
|
-
"test",
|
|
19
20
|
"tsconfig",
|
|
20
|
-
"
|
|
21
|
-
"virtual-modules.d.ts"
|
|
21
|
+
"README.md"
|
|
22
22
|
],
|
|
23
|
+
"main": "./dist/vite.mjs",
|
|
24
|
+
"types": "./dist/vite.d.mts",
|
|
23
25
|
"exports": {
|
|
24
|
-
"
|
|
25
|
-
"types": "./dist
|
|
26
|
-
"
|
|
27
|
-
"default": "./dist/vite.shared.mjs"
|
|
28
|
-
},
|
|
29
|
-
"./typescript/*": "./tsconfig/tsconfig.*.json",
|
|
30
|
-
"./playwright": {
|
|
31
|
-
"types": "./dist/playwright.shared.config.d.mts",
|
|
32
|
-
"import": "./dist/playwright.shared.config.mjs",
|
|
33
|
-
"default": "./dist/playwright.shared.config.mjs"
|
|
34
|
-
},
|
|
35
|
-
"./vitest": {
|
|
36
|
-
"types": "./dist/vite.shared.d.mts",
|
|
37
|
-
"import": "./dist/vite.shared.mjs",
|
|
38
|
-
"default": "./dist/vite.shared.mjs"
|
|
39
|
-
},
|
|
40
|
-
"./test/*": {
|
|
41
|
-
"types": "./dist/test/*.d.mts",
|
|
42
|
-
"import": "./dist/test/*.mjs",
|
|
43
|
-
"default": "./dist/test/*.mjs"
|
|
44
|
-
},
|
|
45
|
-
"./setup/*": {
|
|
46
|
-
"types": "./dist/setup/*.d.mts",
|
|
47
|
-
"import": "./dist/setup/*.mjs",
|
|
48
|
-
"default": "./dist/setup/*.mjs"
|
|
26
|
+
"./*": {
|
|
27
|
+
"types": "./dist/*.d.mts",
|
|
28
|
+
"default": "./dist/*.mjs"
|
|
49
29
|
},
|
|
50
|
-
"./
|
|
51
|
-
"types": "./dist/msw.d.mts",
|
|
52
|
-
"import": "./dist/msw.mjs",
|
|
53
|
-
"default": "./dist/msw.mjs"
|
|
54
|
-
}
|
|
30
|
+
"./tsconfig/*": "./tsconfig/tsconfig.*.json"
|
|
55
31
|
},
|
|
56
32
|
"scripts": {
|
|
57
33
|
"build": "vp pack",
|
|
58
34
|
"bump": "npm version patch --no-git-tag-version",
|
|
59
35
|
"pack": "vp pack",
|
|
60
|
-
"prepublishOnly": "vp
|
|
36
|
+
"prepublishOnly": "vp run build"
|
|
61
37
|
},
|
|
62
|
-
"
|
|
38
|
+
"peerDependencies": {
|
|
63
39
|
"@babel/core": "^7.29.0",
|
|
64
40
|
"@playwright/test": "^1.59.1",
|
|
65
41
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
@@ -72,26 +48,46 @@
|
|
|
72
48
|
"@types/pg": "^8.18.0",
|
|
73
49
|
"@types/react": "^19.2.14",
|
|
74
50
|
"@vitejs/plugin-react": "^6.0.1",
|
|
75
|
-
"@vitest/browser-playwright": "4.1.5",
|
|
76
51
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
77
52
|
"drizzle-orm": "^0.45.1",
|
|
78
53
|
"drizzle-seed": "^0.3.1",
|
|
79
54
|
"get-port": "^7.2.0",
|
|
80
55
|
"msw": "^2.13.4",
|
|
81
|
-
"nitro": "
|
|
56
|
+
"nitro": "*",
|
|
82
57
|
"pg": "^8.20.0",
|
|
83
58
|
"react": "^19.2.4",
|
|
84
59
|
"testcontainers": "^11.12.0",
|
|
85
60
|
"typescript": "^5.8.3",
|
|
86
|
-
"vite": "
|
|
87
|
-
"vite-plus": "latest",
|
|
61
|
+
"vite": "*",
|
|
88
62
|
"vite-plugin-svgr": "^5.2.0",
|
|
89
|
-
"
|
|
63
|
+
"vite-plus": "*",
|
|
90
64
|
"vitest-browser-react": "^2.0.5"
|
|
91
65
|
},
|
|
92
66
|
"devDependencies": {
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"
|
|
67
|
+
"@babel/core": "^7.29.0",
|
|
68
|
+
"@playwright/test": "^1.59.1",
|
|
69
|
+
"@rolldown/plugin-babel": "^0.2.3",
|
|
70
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
71
|
+
"@tanstack/devtools-vite": "^0.6.0",
|
|
72
|
+
"@tanstack/react-start": "^1.166.7",
|
|
73
|
+
"@testcontainers/postgresql": "^11.12.0",
|
|
74
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
75
|
+
"@types/node": "^25.4.0",
|
|
76
|
+
"@types/pg": "^8.18.0",
|
|
77
|
+
"@types/react": "^19.2.14",
|
|
78
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
79
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
80
|
+
"drizzle-orm": "^0.45.1",
|
|
81
|
+
"drizzle-seed": "^0.3.1",
|
|
82
|
+
"msw": "^2.13.4",
|
|
83
|
+
"nitro": "latest",
|
|
84
|
+
"pg": "^8.20.0",
|
|
85
|
+
"react": "^19.2.4",
|
|
86
|
+
"testcontainers": "^11.12.0",
|
|
87
|
+
"typescript": "^5.8.3",
|
|
88
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
89
|
+
"vite-plugin-svgr": "^5.2.0",
|
|
90
|
+
"vite-plus": "latest",
|
|
91
|
+
"vitest-browser-react": "^2.0.5"
|
|
96
92
|
}
|
|
97
93
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
//#region test/internal.ts
|
|
4
|
-
const HANDLER_LOCATIONS = [
|
|
5
|
-
"__mocks__/handlers.ts",
|
|
6
|
-
"__mocks__/handlers.js",
|
|
7
|
-
"src/mocks/handlers.ts",
|
|
8
|
-
"src/mocks/handlers.js"
|
|
9
|
-
];
|
|
10
|
-
function findHandlerPath() {
|
|
11
|
-
if (typeof process === "undefined") return "";
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
for (const location of HANDLER_LOCATIONS) {
|
|
14
|
-
const fullPath = resolve(cwd, location);
|
|
15
|
-
if (existsSync(fullPath)) return fullPath;
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`No MSW handlers found. Expected one of:\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join("\n")}`);
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { findHandlerPath as t };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=internal-Dshd0hdM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal-Dshd0hdM.mjs","names":[],"sources":["../test/internal.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport const HANDLER_LOCATIONS = [\n\t'__mocks__/handlers.ts',\n\t'__mocks__/handlers.js',\n\t'src/mocks/handlers.ts',\n\t'src/mocks/handlers.js',\n]\n\nexport function findHandlerPath(): string {\n\tif (typeof process === 'undefined') {\n\t\treturn ''\n\t}\n\tconst cwd = process.cwd()\n\tfor (const location of HANDLER_LOCATIONS) {\n\t\tconst fullPath = resolve(cwd, location)\n\t\tif (existsSync(fullPath)) return fullPath\n\t}\n\tthrow new Error(\n\t\t`No MSW handlers found. Expected one of:\\n${HANDLER_LOCATIONS.map((l) => ` - ${resolve(cwd, l)}`).join('\\n')}`,\n\t)\n}\n\nexport function createProxy<T extends object>(getTarget: () => T): T {\n\tconst handlers: ProxyHandler<object> = {\n\t\tget(_, prop) {\n\t\t\treturn Reflect.get(getTarget(), prop, getTarget())\n\t\t},\n\t\tapply(target, thisArg, args) {\n\t\t\treturn Reflect.apply(getTarget() as any, thisArg, args)\n\t\t},\n\t\thas(_, prop) {\n\t\t\treturn prop in getTarget()\n\t\t},\n\t\townKeys() {\n\t\t\treturn Reflect.ownKeys(getTarget())\n\t\t},\n\t\tgetOwnPropertyDescriptor(_, prop) {\n\t\t\treturn Reflect.getOwnPropertyDescriptor(getTarget(), prop)\n\t\t},\n\t}\n\tconst proxyTarget = () => {}\n\treturn new Proxy(proxyTarget, handlers) as T\n}\n"],"mappings":";;;AAGA,MAAa,oBAAoB;CAChC;CACA;CACA;CACA;CACA;AAED,SAAgB,kBAA0B;CACzC,IAAI,OAAO,YAAY,aACtB,OAAO;CAER,MAAM,MAAM,QAAQ,KAAK;CACzB,KAAK,MAAM,YAAY,mBAAmB;EACzC,MAAM,WAAW,QAAQ,KAAK,SAAS;EACvC,IAAI,WAAW,SAAS,EAAE,OAAO;;CAElC,MAAM,IAAI,MACT,4CAA4C,kBAAkB,KAAK,MAAM,OAAO,QAAQ,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,GAC7G"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.shared.config.mjs","names":[],"sources":["../playwright.shared.config.ts"],"sourcesContent":["import {\n\tdefineConfig,\n\tdevices,\n\ttype PlaywrightTestConfig,\n} from '@playwright/test'\n\n/** See https://playwright.dev/docs/test-configuration. */\nexport const baseConfig = async (overrides?: PlaywrightTestConfig) => {\n\treturn defineConfig(\n\t\t{\n\t\t\ttestDir: './e2e',\n\t\t\toutputDir: '.playwright/test-results',\n\t\t\t/* Run tests in files in parallel */\n\t\t\tfullyParallel: true,\n\t\t\t// Opt out of parallel tests on CI.\n\t\t\tworkers: process.env.CI ? 1 : '50%',\n\t\t\t/* Fail the build on CI if you accidentally left test.only in the source code. */\n\t\t\tforbidOnly: !!process.env.CI,\n\t\t\tretries: process.env.CI ? 3 : 0,\n\t\t\t/* Reporter to use. See https://playwright.dev/docs/test-reporters */\n\t\t\treporter: [\n\t\t\t\t['html', { open: 'never', outputFolder: '.playwright/report' }],\n\t\t\t],\n\n\t\t\t/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */\n\t\t\tuse: {\n\t\t\t\tcolorScheme: 'dark',\n\n\t\t\t\t/* Base URL to use in actions like `await page.goto('/')`. */\n\t\t\t\tbaseURL: process.env.BASE_URL,\n\n\t\t\t\t/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */\n\t\t\t\ttrace: 'retain-on-first-failure',\n\t\t\t\tscreenshot: 'on',\n\t\t\t\tvideo: 'retain-on-failure',\n\t\t\t},\n\n\t\t\ttimeout: 15_000,\n\t\t\texpect: {\n\t\t\t\ttimeout: 5_000,\n\t\t\t},\n\n\t\t\t/* Configure projects for major browsers */\n\t\t\tprojects: [\n\t\t\t\t{\n\t\t\t\t\tname: 'chromium',\n\t\t\t\t\tuse: {\n\t\t\t\t\t\t...devices['Desktop Chrome'],\n\t\t\t\t\t\tlaunchOptions: {\n\t\t\t\t\t\t\targs: ['--disable-lcd-text'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'mobile',\n\t\t\t\t\tuse: {\n\t\t\t\t\t\t...devices['Desktop Chrome'],\n\t\t\t\t\t\tviewport: {\n\t\t\t\t\t\t\twidth: 320,\n\t\t\t\t\t\t\theight: 800,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlaunchOptions: {\n\t\t\t\t\t\t\targs: ['--disable-lcd-text'],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\toverrides ?? {},\n\t)\n}\n"],"mappings":";;;AAOA,MAAa,aAAa,OAAO,cAAqC;CACrE,OAAO,aACN;EACC,SAAS;EACT,WAAW;EAEX,eAAe;EAEf,SAAS,QAAQ,IAAI,KAAK,IAAI;EAE9B,YAAY,CAAC,CAAC,QAAQ,IAAI;EAC1B,SAAS,QAAQ,IAAI,KAAK,IAAI;EAE9B,UAAU,CACT,CAAC,QAAQ;GAAE,MAAM;GAAS,cAAc;GAAsB,CAAC,CAC/D;EAGD,KAAK;GACJ,aAAa;GAGb,SAAS,QAAQ,IAAI;GAGrB,OAAO;GACP,YAAY;GACZ,OAAO;GACP;EAED,SAAS;EACT,QAAQ,EACP,SAAS,KACT;EAGD,UAAU,CACT;GACC,MAAM;GACN,KAAK;IACJ,GAAG,QAAQ;IACX,eAAe,EACd,MAAM,CAAC,qBAAqB,EAC5B;IACD;GACD,EACD;GACC,MAAM;GACN,KAAK;IACJ,GAAG,QAAQ;IACX,UAAU;KACT,OAAO;KACP,QAAQ;KACR;IACD,eAAe,EACd,MAAM,CAAC,qBAAqB,EAC5B;IACD;GACD,CACD;EACD,EACD,aAAa,EAAE,CACf"}
|
package/dist/test/database.d.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
2
|
-
import { Pool } from "pg";
|
|
3
|
-
|
|
4
|
-
//#region test/database.d.ts
|
|
5
|
-
type Database = NodePgDatabase & {
|
|
6
|
-
$client: Pool;
|
|
7
|
-
};
|
|
8
|
-
interface SeedDatabaseOptions {
|
|
9
|
-
schemaPath: string;
|
|
10
|
-
migrationsFolder: string;
|
|
11
|
-
seedFunction?: (db: Database) => Promise<void>;
|
|
12
|
-
extensions?: string[];
|
|
13
|
-
}
|
|
14
|
-
declare function seedDatabase(db: Database, {
|
|
15
|
-
schemaPath,
|
|
16
|
-
migrationsFolder,
|
|
17
|
-
seedFunction,
|
|
18
|
-
extensions
|
|
19
|
-
}: SeedDatabaseOptions): Promise<void>;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { Database, SeedDatabaseOptions, seedDatabase };
|
|
22
|
-
//# sourceMappingURL=database.d.mts.map
|
package/dist/test/database.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region test/database.ts
|
|
2
|
-
const DEFAULT_EXTENSIONS = ["pg_trgm"];
|
|
3
|
-
async function seedDatabase(db, { schemaPath, migrationsFolder, seedFunction, extensions = DEFAULT_EXTENSIONS }) {
|
|
4
|
-
const { migrate } = await import("drizzle-orm/node-postgres/migrator");
|
|
5
|
-
const { reset } = await import("drizzle-seed");
|
|
6
|
-
const schema = await import(
|
|
7
|
-
/* @vite-ignore */
|
|
8
|
-
schemaPath
|
|
9
|
-
);
|
|
10
|
-
for (const ext of extensions) await db.execute(`CREATE EXTENSION IF NOT EXISTS "${ext}"`);
|
|
11
|
-
await migrate(db, { migrationsFolder });
|
|
12
|
-
await reset(db, schema);
|
|
13
|
-
if (seedFunction) await seedFunction(db);
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { seedDatabase };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=database.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.mjs","names":[],"sources":["../../test/database.ts"],"sourcesContent":["import type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type { Pool } from 'pg'\n\n// Convention: schema at src/db/tables.ts, migrations at src/db/migrations/\nconst DEFAULT_EXTENSIONS = ['pg_trgm']\n\nexport type Database = NodePgDatabase & {\n\t$client: Pool\n}\n\nexport interface SeedDatabaseOptions {\n\tschemaPath: string\n\tmigrationsFolder: string\n\tseedFunction?: (db: Database) => Promise<void>\n\textensions?: string[]\n}\n\nexport async function seedDatabase(\n\tdb: Database,\n\t{\n\t\tschemaPath,\n\t\tmigrationsFolder,\n\t\tseedFunction,\n\t\textensions = DEFAULT_EXTENSIONS,\n\t}: SeedDatabaseOptions,\n) {\n\tconst { migrate } = await import('drizzle-orm/node-postgres/migrator')\n\tconst { reset } = await import('drizzle-seed')\n\n\tconst schema = await import(/* @vite-ignore */ schemaPath)\n\n\tfor (const ext of extensions) {\n\t\tawait db.execute(`CREATE EXTENSION IF NOT EXISTS \"${ext}\"`)\n\t}\n\tawait migrate(db, { migrationsFolder })\n\tawait reset(db, schema)\n\tif (seedFunction) await seedFunction(db)\n}\n"],"mappings":";AAIA,MAAM,qBAAqB,CAAC,UAAU;AAatC,eAAsB,aACrB,IACA,EACC,YACA,kBACA,cACA,aAAa,sBAEb;CACD,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,EAAE,UAAU,MAAM,OAAO;CAE/B,MAAM,SAAS,MAAM;;EAA0B;;CAE/C,KAAK,MAAM,OAAO,YACjB,MAAM,GAAG,QAAQ,mCAAmC,IAAI,GAAG;CAE5D,MAAM,QAAQ,IAAI,EAAE,kBAAkB,CAAC;CACvC,MAAM,MAAM,IAAI,OAAO;CACvB,IAAI,cAAc,MAAM,aAAa,GAAG"}
|
package/dist/test/playwright.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
//#region test/playwright.ts
|
|
3
|
-
async function mockJsonRoute(page, url, fixtureUrl) {
|
|
4
|
-
await page.route(url, async (route) => {
|
|
5
|
-
const body = await readFile(fixtureUrl, "utf8");
|
|
6
|
-
await route.fulfill({
|
|
7
|
-
contentType: "application/json",
|
|
8
|
-
body
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { mockJsonRoute };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=playwright.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.mjs","names":[],"sources":["../../test/playwright.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport type { Page } from '@playwright/test'\n\nexport async function mockJsonRoute(\n\tpage: Page,\n\turl: string | RegExp,\n\tfixtureUrl: URL,\n) {\n\tawait page.route(url, async (route) => {\n\t\tconst body = await readFile(fixtureUrl, 'utf8')\n\n\t\tawait route.fulfill({\n\t\t\tcontentType: 'application/json',\n\t\t\tbody,\n\t\t})\n\t})\n}\n"],"mappings":";;AAGA,eAAsB,cACrB,MACA,KACA,YACC;CACD,MAAM,KAAK,MAAM,KAAK,OAAO,UAAU;EACtC,MAAM,OAAO,MAAM,SAAS,YAAY,OAAO;EAE/C,MAAM,MAAM,QAAQ;GACnB,aAAa;GACb;GACA,CAAC;GACD"}
|
package/dist/test/postgres.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
|
2
|
-
|
|
3
|
-
//#region test/postgres.d.ts
|
|
4
|
-
type State = {
|
|
5
|
-
container: StartedPostgreSqlContainer;
|
|
6
|
-
databaseUrl: string;
|
|
7
|
-
};
|
|
8
|
-
declare function ensurePostgresContainer(): Promise<State | {
|
|
9
|
-
databaseUrl: string;
|
|
10
|
-
}>;
|
|
11
|
-
declare function stopPostgresContainer(): Promise<void>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { ensurePostgresContainer, stopPostgresContainer };
|
|
14
|
-
//# sourceMappingURL=postgres.d.mts.map
|
package/dist/test/postgres.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PostgreSqlContainer } from "@testcontainers/postgresql";
|
|
2
|
-
import { Wait } from "testcontainers";
|
|
3
|
-
//#region test/postgres.ts
|
|
4
|
-
let state;
|
|
5
|
-
async function ensurePostgresContainer() {
|
|
6
|
-
const databaseUrl = process.env.DATABASE_URL;
|
|
7
|
-
if (databaseUrl) return { databaseUrl };
|
|
8
|
-
if (!state) {
|
|
9
|
-
const container = await new PostgreSqlContainer("postgres:17").withDatabase("imdbgraph").withUsername("imdbgraph").withPassword("imdbgraph").withWaitStrategy(Wait.forHealthCheck()).start();
|
|
10
|
-
state = {
|
|
11
|
-
container,
|
|
12
|
-
databaseUrl: container.getConnectionUri()
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return state;
|
|
16
|
-
}
|
|
17
|
-
async function stopPostgresContainer() {
|
|
18
|
-
if (!state) return;
|
|
19
|
-
await state.container.stop();
|
|
20
|
-
state = void 0;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { ensurePostgresContainer, stopPostgresContainer };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=postgres.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.mjs","names":[],"sources":["../../test/postgres.ts"],"sourcesContent":["import {\n\tPostgreSqlContainer,\n\ttype StartedPostgreSqlContainer,\n} from '@testcontainers/postgresql'\nimport { Wait } from 'testcontainers'\n\ntype State = {\n\tcontainer: StartedPostgreSqlContainer\n\tdatabaseUrl: string\n}\n\nlet state: State | undefined\n\nexport async function ensurePostgresContainer() {\n\tconst databaseUrl = process.env.DATABASE_URL\n\tif (databaseUrl) {\n\t\treturn {\n\t\t\tdatabaseUrl,\n\t\t}\n\t}\n\n\tif (!state) {\n\t\tconst container = await new PostgreSqlContainer('postgres:17')\n\t\t\t.withDatabase('imdbgraph')\n\t\t\t.withUsername('imdbgraph')\n\t\t\t.withPassword('imdbgraph')\n\t\t\t.withWaitStrategy(Wait.forHealthCheck())\n\t\t\t.start()\n\n\t\tstate = {\n\t\t\tcontainer,\n\t\t\tdatabaseUrl: container.getConnectionUri(),\n\t\t}\n\t}\n\n\treturn state\n}\n\nexport async function stopPostgresContainer() {\n\tif (!state) return\n\tawait state.container.stop()\n\tstate = undefined\n}\n"],"mappings":";;;AAWA,IAAI;AAEJ,eAAsB,0BAA0B;CAC/C,MAAM,cAAc,QAAQ,IAAI;CAChC,IAAI,aACH,OAAO,EACN,aACA;CAGF,IAAI,CAAC,OAAO;EACX,MAAM,YAAY,MAAM,IAAI,oBAAoB,cAAc,CAC5D,aAAa,YAAY,CACzB,aAAa,YAAY,CACzB,aAAa,YAAY,CACzB,iBAAiB,KAAK,gBAAgB,CAAC,CACvC,OAAO;EAET,QAAQ;GACP;GACA,aAAa,UAAU,kBAAkB;GACzC;;CAGF,OAAO;;AAGR,eAAsB,wBAAwB;CAC7C,IAAI,CAAC,OAAO;CACZ,MAAM,MAAM,UAAU,MAAM;CAC5B,QAAQ,KAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ComponentType, ReactNode } from "react";
|
|
2
|
-
import { Locator } from "vitest/browser";
|
|
3
|
-
import { RenderResult } from "vitest-browser-react";
|
|
4
|
-
|
|
5
|
-
//#region test/visual-page.d.ts
|
|
6
|
-
interface Viewport {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
}
|
|
10
|
-
interface ExpectComponentScreenshotOptions {
|
|
11
|
-
component: ComponentType;
|
|
12
|
-
name: string;
|
|
13
|
-
waitFor: (screen: RenderResult) => Locator;
|
|
14
|
-
prepare?: ((screen: RenderResult) => void | Promise<void>) | undefined;
|
|
15
|
-
target?: ((screen: RenderResult) => Locator) | undefined;
|
|
16
|
-
setup?: (() => void | Promise<void>) | undefined;
|
|
17
|
-
wrapper?: ComponentType<{
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
}> | undefined;
|
|
20
|
-
viewport?: Viewport | undefined;
|
|
21
|
-
fullPage?: boolean | undefined;
|
|
22
|
-
}
|
|
23
|
-
declare function expectComponentScreenshot({
|
|
24
|
-
component,
|
|
25
|
-
name,
|
|
26
|
-
waitFor,
|
|
27
|
-
prepare,
|
|
28
|
-
target,
|
|
29
|
-
setup,
|
|
30
|
-
wrapper,
|
|
31
|
-
viewport,
|
|
32
|
-
fullPage
|
|
33
|
-
}: ExpectComponentScreenshotOptions): Promise<void>;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { expectComponentScreenshot };
|
|
36
|
-
//# sourceMappingURL=visual-page.d.mts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { expect } from "vitest";
|
|
2
|
-
import { createElement } from "react";
|
|
3
|
-
import { page } from "vitest/browser";
|
|
4
|
-
import { render } from "vitest-browser-react";
|
|
5
|
-
//#region test/visual-page.ts
|
|
6
|
-
async function expectComponentScreenshot({ component, name, waitFor, prepare, target = (screen) => screen.locator, setup, wrapper, viewport = {
|
|
7
|
-
width: 1280,
|
|
8
|
-
height: 720
|
|
9
|
-
}, fullPage = true }) {
|
|
10
|
-
localStorage.clear();
|
|
11
|
-
document.body.replaceChildren();
|
|
12
|
-
await setup?.();
|
|
13
|
-
await page.viewport(viewport.width, viewport.height);
|
|
14
|
-
const container = document.body.appendChild(document.createElement("div"));
|
|
15
|
-
container.style.width = "100vw";
|
|
16
|
-
container.style.minHeight = "100vh";
|
|
17
|
-
const screen = await render(createElement(component), wrapper ? {
|
|
18
|
-
container,
|
|
19
|
-
wrapper
|
|
20
|
-
} : { container });
|
|
21
|
-
await prepare?.(screen);
|
|
22
|
-
await expect.element(waitFor(screen)).toBeVisible();
|
|
23
|
-
await document.fonts.ready;
|
|
24
|
-
if (fullPage) await page.viewport(viewport.width, Math.ceil(container.scrollHeight));
|
|
25
|
-
await expect.element(target(screen)).toMatchScreenshot(`${name}.png`, { screenshotOptions: { scale: "css" } });
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { expectComponentScreenshot };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=visual-page.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visual-page.mjs","names":[],"sources":["../../test/visual-page.ts"],"sourcesContent":["import { createElement, type ComponentType, type ReactNode } from 'react'\nimport { expect } from 'vitest'\nimport { page, type Locator } from 'vitest/browser'\nimport { render, type RenderResult } from 'vitest-browser-react'\n\ninterface Viewport {\n\twidth: number\n\theight: number\n}\n\ninterface ExpectComponentScreenshotOptions {\n\tcomponent: ComponentType\n\tname: string\n\twaitFor: (screen: RenderResult) => Locator\n\tprepare?: ((screen: RenderResult) => void | Promise<void>) | undefined\n\ttarget?: ((screen: RenderResult) => Locator) | undefined\n\tsetup?: (() => void | Promise<void>) | undefined\n\twrapper?: ComponentType<{ children: ReactNode }> | undefined\n\tviewport?: Viewport | undefined\n\tfullPage?: boolean | undefined\n}\n\nexport async function expectComponentScreenshot({\n\tcomponent,\n\tname,\n\twaitFor,\n\tprepare,\n\ttarget = (screen) => screen.locator,\n\tsetup,\n\twrapper,\n\tviewport = { width: 1280, height: 720 },\n\tfullPage = true,\n}: ExpectComponentScreenshotOptions) {\n\tlocalStorage.clear()\n\tdocument.body.replaceChildren()\n\tawait setup?.()\n\tawait page.viewport(viewport.width, viewport.height)\n\n\tconst container = document.body.appendChild(document.createElement('div'))\n\tcontainer.style.width = '100vw'\n\tcontainer.style.minHeight = '100vh'\n\n\tconst screen = await render(\n\t\tcreateElement(component),\n\t\twrapper ? { container, wrapper } : { container },\n\t)\n\n\tawait prepare?.(screen)\n\tawait expect.element(waitFor(screen)).toBeVisible()\n\tawait document.fonts.ready\n\tif (fullPage) {\n\t\tawait page.viewport(viewport.width, Math.ceil(container.scrollHeight))\n\t}\n\tawait expect.element(target(screen)).toMatchScreenshot(`${name}.png`, {\n\t\tscreenshotOptions: { scale: 'css' },\n\t})\n}\n"],"mappings":";;;;;AAsBA,eAAsB,0BAA0B,EAC/C,WACA,MACA,SACA,SACA,UAAU,WAAW,OAAO,SAC5B,OACA,SACA,WAAW;CAAE,OAAO;CAAM,QAAQ;CAAK,EACvC,WAAW,QACyB;CACpC,aAAa,OAAO;CACpB,SAAS,KAAK,iBAAiB;CAC/B,MAAM,SAAS;CACf,MAAM,KAAK,SAAS,SAAS,OAAO,SAAS,OAAO;CAEpD,MAAM,YAAY,SAAS,KAAK,YAAY,SAAS,cAAc,MAAM,CAAC;CAC1E,UAAU,MAAM,QAAQ;CACxB,UAAU,MAAM,YAAY;CAE5B,MAAM,SAAS,MAAM,OACpB,cAAc,UAAU,EACxB,UAAU;EAAE;EAAW;EAAS,GAAG,EAAE,WAAW,CAChD;CAED,MAAM,UAAU,OAAO;CACvB,MAAM,OAAO,QAAQ,QAAQ,OAAO,CAAC,CAAC,aAAa;CACnD,MAAM,SAAS,MAAM;CACrB,IAAI,UACH,MAAM,KAAK,SAAS,SAAS,OAAO,KAAK,KAAK,UAAU,aAAa,CAAC;CAEvE,MAAM,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,kBAAkB,GAAG,KAAK,OAAO,EACrE,mBAAmB,EAAE,OAAO,OAAO,EACnC,CAAC"}
|