@aamini/config 0.0.19 → 0.2.0
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/README.md +111 -20
- package/dist/anti-slop/index.d.mts +6 -0
- package/dist/anti-slop/index.mjs +2414 -0
- package/dist/anti-slop/index.mjs.map +1 -0
- package/dist/merge-BEomHgbw.d.mts +21 -0
- package/dist/merge-DThKwm_6.mjs +193 -0
- package/dist/merge-DThKwm_6.mjs.map +1 -0
- package/dist/playwright.d.mts +8 -3
- package/dist/playwright.mjs +20 -11
- package/dist/playwright.mjs.map +1 -1
- package/dist/root-U5B4x0aj.mjs +15 -0
- package/dist/root-U5B4x0aj.mjs.map +1 -0
- package/dist/tanstack/index.d.mts +45 -0
- package/dist/tanstack/index.mjs +189 -0
- package/dist/tanstack/index.mjs.map +1 -0
- package/dist/vite-plus/index.d.mts +101 -0
- package/dist/vite-plus/index.mjs +2 -0
- package/dist/vitest/browser.d.mts +22 -0
- package/dist/vitest/browser.mjs +84 -0
- package/dist/vitest/browser.mjs.map +1 -0
- package/dist/vitest/db.d.mts +28 -0
- package/dist/vitest/db.mjs +42 -0
- package/dist/vitest/db.mjs.map +1 -0
- package/dist/vitest/index.d.mts +29 -0
- package/dist/vitest/index.mjs +2 -0
- package/dist/vitest/react.d.mts +34 -0
- package/dist/vitest/react.mjs +43 -0
- package/dist/vitest/react.mjs.map +1 -0
- package/dist/vitest/server.d.mts +13 -0
- package/dist/vitest/server.mjs +28 -0
- package/dist/vitest/server.mjs.map +1 -0
- package/dist/vitest-CXdvqyRH.mjs +169 -0
- package/dist/vitest-CXdvqyRH.mjs.map +1 -0
- package/package.json +169 -95
- package/tsconfig/astro.json +9 -0
- package/tsconfig/{tsconfig.strict.json → base.json} +8 -0
- package/tsconfig/react.json +9 -0
- package/dist/setup/styles.d.mts +0 -1
- package/dist/setup/styles.mjs +0 -2
- package/dist/test/browser.d.mts +0 -17
- package/dist/test/browser.mjs +0 -35
- package/dist/test/browser.mjs.map +0 -1
- package/dist/test/db.d.mts +0 -41
- package/dist/test/db.mjs +0 -93
- package/dist/test/db.mjs.map +0 -1
- package/dist/test/server.d.mts +0 -16
- package/dist/test/server.mjs +0 -30
- package/dist/test/server.mjs.map +0 -1
- package/dist/test/visual-page.d.mts +0 -30
- package/dist/test/visual-page.mjs +0 -40
- package/dist/test/visual-page.mjs.map +0 -1
- package/dist/vite.d.mts +0 -73
- package/dist/vite.mjs +0 -208
- package/dist/vite.mjs.map +0 -1
- package/tsconfig/tsconfig.lib.json +0 -19
- package/tsconfig/tsconfig.tanstack.json +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest-CXdvqyRH.mjs","names":[],"sources":["../src/options.ts","../src/peers.ts","../src/vitest/msw-worker.ts","../src/vitest/index.ts"],"sourcesContent":["function isPlainObject<T>(value: T): value is T & object {\n\treturn (\n\t\tvalue !== null &&\n\t\tvalue instanceof Object &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/** Deep merges toolkit options. Arrays and other values replace. */\nexport function mergeOptions<T extends object>(\n\tdefaults: T,\n\toverride: T | undefined,\n): T {\n\tif (override === undefined) return defaults\n\n\tconst merged = { ...defaults, ...override }\n\n\tfor (const key in override) {\n\t\tconst preset = defaults[key]\n\t\tconst value = override[key]\n\n\t\tif (isPlainObject(preset) && isPlainObject(value)) {\n\t\t\tmerged[key] = mergeOptions(preset, value)\n\t\t}\n\t}\n\n\treturn merged\n}\n","export interface Peer {\n\t/** The npm package that the app installs. */\n\tname: string\n\t/** The module that the entry imports from the package. */\n\tspecifier: string\n}\n\n/** Resolves from this package, so pnpm sees each declared peer. */\nexport function canResolve(specifier: string) {\n\ttry {\n\t\timport.meta.resolve(specifier)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\nfunction missingPeer(entry: string, peer: Peer, cause?: Error) {\n\treturn new Error(\n\t\t`${entry} needs ${peer.name}. Install it with: pnpm add -D ${peer.name}`,\n\t\t{ cause },\n\t)\n}\n\n/**\n * Imports a peer module. If the app did not install the peer, the error names\n * the package and the command that installs it.\n */\nexport async function importPeer<T>(\n\tentry: string,\n\tpeer: Peer,\n\tload: () => Promise<T>,\n): Promise<T> {\n\ttry {\n\t\treturn await load()\n\t} catch (error) {\n\t\tif (error instanceof Error && !canResolve(peer.specifier)) {\n\t\t\tthrow missingPeer(entry, peer, error)\n\t\t}\n\n\t\tthrow error\n\t}\n}\n\n/** Checks a peer that another tool loads, for example a Babel or Oxlint plugin. */\nexport function requirePeer(entry: string, peer: Peer) {\n\tif (!canResolve(peer.specifier)) throw missingPeer(entry, peer)\n}\n","import { readFile } from 'node:fs/promises'\nimport { fileURLToPath } from 'node:url'\n\nimport type { Plugin } from 'vite-plus'\n\nexport const workerModule = 'msw/mockServiceWorker.js'\n\n/**\n * Serves the MSW service worker script to browser tests from the `msw`\n * package. Vitest 4 served this path itself; Vitest 5 does not. Apps keep the\n * script out of `public/`, so production never ships it.\n */\nexport function mswWorker(): Plugin {\n\tconst workerPath = fileURLToPath(import.meta.resolve(workerModule))\n\n\treturn {\n\t\tname: 'aamini:msw-worker',\n\t\tconfigureServer(server) {\n\t\t\tserver.middlewares.use('/mockServiceWorker.js', (_request, response) => {\n\t\t\t\tvoid readFile(workerPath)\n\t\t\t\t\t.then((script) => {\n\t\t\t\t\t\tresponse.setHeader('Content-Type', 'text/javascript')\n\t\t\t\t\t\tresponse.end(script)\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tserver.config.logger.error(\n\t\t\t\t\t\t\t`Failed to serve mockServiceWorker.js: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tresponse.statusCode = 500\n\t\t\t\t\t\tresponse.end()\n\t\t\t\t\t})\n\t\t\t})\n\t\t},\n\t}\n}\n","import type { Plugin, TestProjectInlineConfiguration } from 'vite-plus'\nimport type { BrowserCommand } from 'vite-plus/test/node'\n\nimport { mergeOptions } from '../options.ts'\nimport { canResolve, importPeer } from '../peers.ts'\nimport { mswWorker, workerModule } from './msw-worker.ts'\n\ntype ProjectTest = NonNullable<TestProjectInlineConfiguration['test']>\n\n/** Vitest `test` options for one project. Arrays replace the toolkit values. */\nexport type ProjectOptions = ProjectTest\n\nexport interface TestProject {\n\textends: true\n\tplugins?: Plugin[]\n\ttest: ProjectOptions\n}\n\nexport const viewports = {\n\tdesktop: { width: 1280, height: 720 },\n\tmobile: { width: 375, height: 812 },\n}\n\nfunction project(\n\tdefaults: ProjectTest,\n\toptions: ProjectOptions | undefined,\n): TestProject {\n\treturn { extends: true, test: mergeOptions(defaults, options) }\n}\n\nexport function unitProject(options?: ProjectOptions): TestProject {\n\treturn project(\n\t\t{\n\t\t\tname: 'unit',\n\t\t\tinclude: [\n\t\t\t\t'src/**/*.unit.test.ts',\n\t\t\t\t'src/**/*.test.unit.ts',\n\t\t\t\t'tests/**/*.unit.test.ts',\n\t\t\t],\n\t\t},\n\t\toptions,\n\t)\n}\n\nexport function serverProject(options?: ProjectOptions): TestProject {\n\treturn project(\n\t\t{\n\t\t\tname: 'server',\n\t\t\tinclude: ['src/**/*.server.test.ts', 'src/**/server.test.ts'],\n\t\t\ttestTimeout: 30_000,\n\t\t\tfileParallelism: false,\n\t\t},\n\t\toptions,\n\t)\n}\n\nconst resetScreenshotPointer: BrowserCommand = async ({ page }) => {\n\tawait page.mouse.move(0, 0)\n}\n\nconst resizeBrowserViewport: BrowserCommand<\n\t[width: number, height: number]\n> = async ({ page }, width, height) => {\n\tawait page.setViewportSize({ width, height })\n}\n\n/**\n * The browser project: Chromium through Playwright, one instance per\n * viewport. The instance name is the baseline suffix for mobile captures.\n */\nexport async function browserProject(\n\toptions?: ProjectOptions,\n): Promise<TestProject> {\n\tconst { playwright } = await importPeer(\n\t\t'@aamini/config/vitest',\n\t\t{\n\t\t\tname: '@vitest/browser-playwright',\n\t\t\tspecifier: '@vitest/browser-playwright',\n\t\t},\n\t\t() => import('vite-plus/test/browser-playwright'),\n\t)\n\n\tconst browser = project(\n\t\t{\n\t\t\tname: 'browser',\n\t\t\t// Docker network changes in server tests abort Chromium module requests.\n\t\t\tsequence: { groupOrder: 1 },\n\t\t\tinclude: ['src/**/*.test.tsx', 'tests/**/*.test.tsx'],\n\t\t\tfileParallelism: false,\n\t\t\tretry: 0,\n\t\t\ttestTimeout: 15_000,\n\t\t\tbrowser: {\n\t\t\t\tenabled: true,\n\t\t\t\theadless: true,\n\t\t\t\tcommands: { resetScreenshotPointer, resizeBrowserViewport },\n\t\t\t\tinstances: [\n\t\t\t\t\t{ browser: 'chromium', name: 'desktop', viewport: viewports.desktop },\n\t\t\t\t\t{ browser: 'chromium', name: 'mobile', viewport: viewports.mobile },\n\t\t\t\t],\n\t\t\t\tprovider: playwright({\n\t\t\t\t\tlaunchOptions: {\n\t\t\t\t\t\tchannel: 'chromium',\n\t\t\t\t\t\targs: ['--disable-lcd-text', '--headless=new'],\n\t\t\t\t\t},\n\t\t\t\t\tactionTimeout: 3_000,\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t\toptions,\n\t)\n\n\tif (canResolve(workerModule)) browser.plugins = [mswWorker()]\n\n\treturn browser\n}\n"],"mappings":";;;AAAA,SAAS,cAAiB,OAA+B;CACxD,OACC,UAAU,QACV,iBAAiB,UACjB,OAAO,eAAe,KAAK,MAAM,OAAO;AAE1C;;AAGA,SAAgB,aACf,UACA,UACI;CACJ,IAAI,aAAa,KAAA,GAAW,OAAO;CAEnC,MAAM,SAAS;EAAE,GAAG;EAAU,GAAG;CAAS;CAE1C,KAAK,MAAM,OAAO,UAAU;EAC3B,MAAM,SAAS,SAAS;EACxB,MAAM,QAAQ,SAAS;EAEvB,IAAI,cAAc,MAAM,KAAK,cAAc,KAAK,GAC/C,OAAO,OAAO,aAAa,QAAQ,KAAK;CAE1C;CAEA,OAAO;AACR;;;;ACnBA,SAAgB,WAAW,WAAmB;CAC7C,IAAI;EACH,YAAY,QAAQ,SAAS;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
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
2
|
+
"name": "@aamini/config",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Shared Vite+, lint, format, type, and test config for aria-amini apps",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/aria-amini/toolkit.git",
|
|
10
|
+
"directory": "packages/config"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/aria-amini/toolkit/tree/main/packages/config#readme",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"provenance": true
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"tsconfig"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
"./tanstack": {
|
|
23
|
+
"types": "./dist/tanstack/index.d.mts",
|
|
24
|
+
"default": "./dist/tanstack/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"./vite-plus": {
|
|
27
|
+
"types": "./dist/vite-plus/index.d.mts",
|
|
28
|
+
"default": "./dist/vite-plus/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"./anti-slop": {
|
|
31
|
+
"types": "./dist/anti-slop/index.d.mts",
|
|
32
|
+
"default": "./dist/anti-slop/index.mjs"
|
|
33
|
+
},
|
|
34
|
+
"./vitest": {
|
|
35
|
+
"types": "./dist/vitest/index.d.mts",
|
|
36
|
+
"default": "./dist/vitest/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./vitest/browser": {
|
|
39
|
+
"types": "./dist/vitest/browser.d.mts",
|
|
40
|
+
"default": "./dist/vitest/browser.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./vitest/react": {
|
|
43
|
+
"types": "./dist/vitest/react.d.mts",
|
|
44
|
+
"default": "./dist/vitest/react.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./vitest/server": {
|
|
47
|
+
"types": "./dist/vitest/server.d.mts",
|
|
48
|
+
"default": "./dist/vitest/server.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./vitest/db": {
|
|
51
|
+
"types": "./dist/vitest/db.d.mts",
|
|
52
|
+
"default": "./dist/vitest/db.mjs"
|
|
53
|
+
},
|
|
54
|
+
"./playwright": {
|
|
55
|
+
"types": "./dist/playwright.d.mts",
|
|
56
|
+
"default": "./dist/playwright.mjs"
|
|
57
|
+
},
|
|
58
|
+
"./tsconfig/*.json": "./tsconfig/*.json",
|
|
59
|
+
"./package.json": "./package.json"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@playwright/test": "^1.61.0",
|
|
63
|
+
"@rolldown/plugin-babel": "^0.2.4",
|
|
64
|
+
"@shadcn/lint": "^0.2.1",
|
|
65
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
66
|
+
"@tanstack/devtools-vite": "^0.8.0",
|
|
67
|
+
"@tanstack/react-start": "^1.168.0",
|
|
68
|
+
"@testcontainers/postgresql": "^12.0.3",
|
|
69
|
+
"@varlock/vite-integration": "^1.5.3",
|
|
70
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
71
|
+
"@vitest/browser-playwright": "^5.0.3",
|
|
72
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
73
|
+
"drizzle-orm": "^1.0.0-rc.4",
|
|
74
|
+
"msw": "^2.14.6",
|
|
75
|
+
"nitro": "^3.0.260610-beta",
|
|
76
|
+
"oxlint-plugin-eslint": "^1.73.0",
|
|
77
|
+
"pg": "^8.22.0",
|
|
78
|
+
"react": "^19.2.0",
|
|
79
|
+
"vite-plus": "^1.1.0",
|
|
80
|
+
"vitest-browser-react": "^2.2.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@playwright/test": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@rolldown/plugin-babel": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@shadcn/lint": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@tailwindcss/vite": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@tanstack/devtools-vite": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@tanstack/react-start": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@testcontainers/postgresql": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"@varlock/vite-integration": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"@vitejs/plugin-react": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"@vitest/browser-playwright": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"babel-plugin-react-compiler": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"drizzle-orm": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
119
|
+
"msw": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
122
|
+
"nitro": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"oxlint-plugin-eslint": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"pg": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"react": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"vitest-browser-react": {
|
|
135
|
+
"optional": true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"devDependencies": {
|
|
139
|
+
"@playwright/test": "^1.64.0",
|
|
140
|
+
"@rolldown/plugin-babel": "^0.2.4",
|
|
141
|
+
"@shadcn/lint": "^0.2.1",
|
|
142
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
143
|
+
"@tanstack/devtools-vite": "0.8.0",
|
|
144
|
+
"@tanstack/react-start": "1.168.32",
|
|
145
|
+
"@testcontainers/postgresql": "^12.2.0",
|
|
146
|
+
"@types/node": "^26.1.1",
|
|
147
|
+
"@types/pg": "^8.23.1",
|
|
148
|
+
"@types/react": "^19.3.0",
|
|
149
|
+
"@varlock/vite-integration": "^1.5.3",
|
|
150
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
151
|
+
"@vitest/browser-playwright": "5.0.3",
|
|
152
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
153
|
+
"drizzle-orm": "1.0.0-rc.4",
|
|
154
|
+
"msw": "^2.15.0",
|
|
155
|
+
"nitro": "3.0.260610-beta",
|
|
156
|
+
"pg": "^8.23.1",
|
|
157
|
+
"react": "^19.3.0",
|
|
158
|
+
"react-dom": "^19.3.0",
|
|
159
|
+
"tailwindcss": "^4.3.3",
|
|
160
|
+
"testcontainers": "^12.2.0",
|
|
161
|
+
"typescript": "6.0.3",
|
|
162
|
+
"varlock": "^1.22.0",
|
|
163
|
+
"vite-plus": "1.1.0",
|
|
164
|
+
"vitest": "5.0.3",
|
|
165
|
+
"vitest-browser-react": "^2.3.0"
|
|
166
|
+
},
|
|
167
|
+
"scripts": {
|
|
168
|
+
"build": "vp pack"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
2
3
|
"compilerOptions": {
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"verbatimModuleSyntax": false,
|
|
10
|
+
"noEmit": true,
|
|
3
11
|
"skipLibCheck": true,
|
|
4
12
|
"strict": true,
|
|
5
13
|
"noUnusedLocals": true,
|
package/dist/setup/styles.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/setup/styles.mjs
DELETED
package/dist/test/browser.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SetupWorker } from "msw/browser";
|
|
2
|
-
import { ExpectPollOptions, TestAPI, afterEach, beforeEach, describe, expect as expect$1, vi } from "vite-plus/test";
|
|
3
|
-
import { Locator } from "vite-plus/test/browser";
|
|
4
|
-
|
|
5
|
-
//#region src/test/browser.d.ts
|
|
6
|
-
interface MswBrowserFixture {
|
|
7
|
-
worker: SetupWorker;
|
|
8
|
-
_cleanup: void;
|
|
9
|
-
}
|
|
10
|
-
type BrowserElementExpectation = {
|
|
11
|
-
element: <T extends HTMLElement | SVGElement | null | Locator>(element: T, options?: ExpectPollOptions) => any;
|
|
12
|
-
};
|
|
13
|
-
declare const expect: typeof expect$1 & BrowserElementExpectation;
|
|
14
|
-
declare const test: TestAPI<MswBrowserFixture>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { MswBrowserFixture, afterEach, beforeEach, describe, expect, test, vi };
|
|
17
|
-
//# sourceMappingURL=browser.d.mts.map
|
package/dist/test/browser.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { setupWorker } from "msw/browser";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect as expect$1, test as test$1, vi } from "vite-plus/test";
|
|
3
|
-
//#region src/test/browser.ts
|
|
4
|
-
let workerSingleton;
|
|
5
|
-
async function ensureWorker() {
|
|
6
|
-
if (!workerSingleton) {
|
|
7
|
-
const { default: handlers } = await import("@test/handlers");
|
|
8
|
-
workerSingleton = setupWorker(...handlers);
|
|
9
|
-
}
|
|
10
|
-
return workerSingleton;
|
|
11
|
-
}
|
|
12
|
-
const extended = test$1.extend({
|
|
13
|
-
worker: [async ({}, use) => {
|
|
14
|
-
const worker = await ensureWorker();
|
|
15
|
-
await worker.start({
|
|
16
|
-
quiet: true,
|
|
17
|
-
onUnhandledRequest: "bypass"
|
|
18
|
-
});
|
|
19
|
-
await use(worker);
|
|
20
|
-
worker.stop();
|
|
21
|
-
}, {
|
|
22
|
-
auto: true,
|
|
23
|
-
scope: "worker"
|
|
24
|
-
}],
|
|
25
|
-
_cleanup: [async ({ worker }, use) => {
|
|
26
|
-
await use();
|
|
27
|
-
worker.resetHandlers();
|
|
28
|
-
}, { auto: true }]
|
|
29
|
-
});
|
|
30
|
-
const expect = expect$1;
|
|
31
|
-
const test = extended;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { afterEach, beforeEach, describe, expect, test, vi };
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=browser.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.mjs","names":["baseTest","baseExpect"],"sources":["../../src/test/browser.ts"],"sourcesContent":["import { setupWorker, type SetupWorker } from 'msw/browser'\nimport { expect as baseExpect, test as baseTest } from 'vite-plus/test'\nimport type { ExpectPollOptions, TestAPI } from 'vite-plus/test'\nimport type { Locator } from 'vite-plus/test/browser'\n\nexport interface MswBrowserFixture {\n\tworker: SetupWorker\n\t_cleanup: void\n}\n\ntype BrowserElementExpectation = {\n\telement: <T extends HTMLElement | SVGElement | null | Locator>(\n\t\telement: T,\n\t\toptions?: ExpectPollOptions,\n\t) => any\n}\n\nlet workerSingleton: SetupWorker | undefined\n\nasync function ensureWorker(): Promise<SetupWorker> {\n\tif (!workerSingleton) {\n\t\tconst { default: handlers } = await import('@test/handlers')\n\t\tworkerSingleton = setupWorker(...handlers)\n\t}\n\treturn workerSingleton\n}\n\nconst extended = baseTest.extend<MswBrowserFixture>({\n\tworker: [\n\t\tasync ({}, use) => {\n\t\t\tconst worker = await ensureWorker()\n\t\t\tawait worker.start({ quiet: true, onUnhandledRequest: 'bypass' })\n\t\t\tawait use(worker)\n\t\t\tworker.stop()\n\t\t},\n\t\t{ auto: true, scope: 'worker' },\n\t],\n\t_cleanup: [\n\t\tasync ({ worker }, use) => {\n\t\t\tawait use()\n\t\t\tworker.resetHandlers()\n\t\t},\n\t\t{ auto: true },\n\t],\n})\n\nexport { afterEach, beforeEach, describe, vi } from 'vite-plus/test'\nexport const expect = baseExpect as typeof baseExpect &\n\tBrowserElementExpectation\nexport const test = extended as TestAPI<MswBrowserFixture>\n"],"mappings":";;;AAiBA,IAAI;AAEJ,eAAe,eAAqC;CACnD,IAAI,CAAC,iBAAiB;EACrB,MAAM,EAAE,SAAS,aAAa,MAAM,OAAO;EAC3C,kBAAkB,YAAY,GAAG,SAAS;;CAE3C,OAAO;;AAGR,MAAM,WAAWA,OAAS,OAA0B;CACnD,QAAQ,CACP,OAAO,IAAI,QAAQ;EAClB,MAAM,SAAS,MAAM,cAAc;EACnC,MAAM,OAAO,MAAM;GAAE,OAAO;GAAM,oBAAoB;GAAU,CAAC;EACjE,MAAM,IAAI,OAAO;EACjB,OAAO,MAAM;IAEd;EAAE,MAAM;EAAM,OAAO;EAAU,CAC/B;CACD,UAAU,CACT,OAAO,EAAE,UAAU,QAAQ;EAC1B,MAAM,KAAK;EACX,OAAO,eAAe;IAEvB,EAAE,MAAM,MAAM,CACd;CACD,CAAC;AAGF,MAAa,SAASC;AAEtB,MAAa,OAAO"}
|
package/dist/test/db.d.mts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as _$vite_plus_test0 from "vite-plus/test";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, vi } from "vite-plus/test";
|
|
3
|
-
import { SetupServer } from "msw/node";
|
|
4
|
-
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
5
|
-
import { Pool } from "pg";
|
|
6
|
-
|
|
7
|
-
//#region src/test/db.d.ts
|
|
8
|
-
interface DbConfig {
|
|
9
|
-
root?: string;
|
|
10
|
-
schemaPath?: string;
|
|
11
|
-
postgresImage?: string;
|
|
12
|
-
}
|
|
13
|
-
type Database = NodePgDatabase & {
|
|
14
|
-
$client: Pool;
|
|
15
|
-
};
|
|
16
|
-
interface DbFixture {
|
|
17
|
-
server: SetupServer;
|
|
18
|
-
_cleanup: void;
|
|
19
|
-
db: Database;
|
|
20
|
-
seedFunction: (db: Database) => Promise<void> | void;
|
|
21
|
-
}
|
|
22
|
-
declare const test: _$vite_plus_test0.TestAPI<{
|
|
23
|
-
server: SetupServer;
|
|
24
|
-
_cleanup: void;
|
|
25
|
-
db: Database;
|
|
26
|
-
seedFunction: (db: Database) => Promise<void> | void;
|
|
27
|
-
}>;
|
|
28
|
-
declare function initDb(seed: (db: Database) => Promise<void> | void, config?: DbConfig): void;
|
|
29
|
-
interface SeedDatabaseOptions {
|
|
30
|
-
schemaPath: string;
|
|
31
|
-
seedFunction?: (db: Database) => Promise<void> | void;
|
|
32
|
-
extensions?: string[];
|
|
33
|
-
}
|
|
34
|
-
declare function seedDatabase(db: Database, {
|
|
35
|
-
schemaPath,
|
|
36
|
-
seedFunction,
|
|
37
|
-
extensions
|
|
38
|
-
}: SeedDatabaseOptions): Promise<void>;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { Database, DbConfig, DbFixture, SeedDatabaseOptions, afterEach, beforeEach, describe, expect, initDb, seedDatabase, test, vi };
|
|
41
|
-
//# sourceMappingURL=db.d.mts.map
|
package/dist/test/db.mjs
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { dirname, resolve } from "node:path";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, test as test$1, vi } from "vite-plus/test";
|
|
4
|
-
import { setupServer } from "msw/node";
|
|
5
|
-
//#region src/test/db.ts
|
|
6
|
-
const DEFAULT_SCHEMA_PATH = "src/db/tables.ts";
|
|
7
|
-
const DEFAULT_IMAGE = "postgres:17";
|
|
8
|
-
const DEFAULT_EXTENSIONS = ["pg_trgm"];
|
|
9
|
-
const ROOT_MARKERS = [
|
|
10
|
-
"vite.config.ts",
|
|
11
|
-
"vite.config.mts",
|
|
12
|
-
"vite.config.js",
|
|
13
|
-
"vite.config.mjs",
|
|
14
|
-
"vitest.config.ts",
|
|
15
|
-
"vitest.config.mts",
|
|
16
|
-
"vitest.config.js",
|
|
17
|
-
"vitest.config.mjs"
|
|
18
|
-
];
|
|
19
|
-
let dbConfig = {};
|
|
20
|
-
let mswServer;
|
|
21
|
-
let seedFunction = async () => {};
|
|
22
|
-
async function ensureMswServer() {
|
|
23
|
-
if (!mswServer) {
|
|
24
|
-
const { default: handlers } = await import("@test/handlers");
|
|
25
|
-
mswServer = setupServer(...handlers);
|
|
26
|
-
}
|
|
27
|
-
return mswServer;
|
|
28
|
-
}
|
|
29
|
-
function findProjectRoot(start = process.cwd()) {
|
|
30
|
-
let directory = start;
|
|
31
|
-
while (true) {
|
|
32
|
-
if (ROOT_MARKERS.some((marker) => existsSync(resolve(directory, marker)))) return directory;
|
|
33
|
-
const parent = dirname(directory);
|
|
34
|
-
if (parent === directory) return start;
|
|
35
|
-
directory = parent;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const test = test$1.extend({
|
|
39
|
-
server: [async ({}, use) => {
|
|
40
|
-
const server = await ensureMswServer();
|
|
41
|
-
server.listen({ onUnhandledRequest: "bypass" });
|
|
42
|
-
await use(server);
|
|
43
|
-
server.close();
|
|
44
|
-
}, {
|
|
45
|
-
auto: true,
|
|
46
|
-
scope: "worker"
|
|
47
|
-
}],
|
|
48
|
-
_cleanup: [async ({ server }, use) => {
|
|
49
|
-
await use();
|
|
50
|
-
server.resetHandlers();
|
|
51
|
-
}, { auto: true }],
|
|
52
|
-
seedFunction: [async ({}, use) => use(seedFunction), { scope: "file" }],
|
|
53
|
-
db: [async ({ seedFunction }, use) => {
|
|
54
|
-
const { PostgreSqlContainer } = await import("@testcontainers/postgresql");
|
|
55
|
-
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
56
|
-
const { Wait } = await import("testcontainers");
|
|
57
|
-
const { Pool } = await import("pg");
|
|
58
|
-
const schemaPath = resolve(dbConfig.root ?? findProjectRoot(), dbConfig.schemaPath ?? DEFAULT_SCHEMA_PATH);
|
|
59
|
-
const container = await new PostgreSqlContainer(dbConfig.postgresImage ?? DEFAULT_IMAGE).withWaitStrategy(Wait.forHealthCheck()).start();
|
|
60
|
-
const client = new Pool({ connectionString: container.getConnectionUri() });
|
|
61
|
-
const db = Object.assign(drizzle({ client }), { $client: client });
|
|
62
|
-
try {
|
|
63
|
-
await seedDatabase(db, {
|
|
64
|
-
schemaPath,
|
|
65
|
-
seedFunction
|
|
66
|
-
});
|
|
67
|
-
await use(db);
|
|
68
|
-
} finally {
|
|
69
|
-
await db.$client.end();
|
|
70
|
-
await container.stop();
|
|
71
|
-
}
|
|
72
|
-
}, { scope: "file" }]
|
|
73
|
-
});
|
|
74
|
-
function initDb(seed, config = {}) {
|
|
75
|
-
dbConfig = config;
|
|
76
|
-
seedFunction = seed;
|
|
77
|
-
}
|
|
78
|
-
async function seedDatabase(db, { schemaPath, seedFunction, extensions = DEFAULT_EXTENSIONS }) {
|
|
79
|
-
const { pushSchema } = await import("drizzle-kit/api");
|
|
80
|
-
const { reset } = await import("drizzle-seed");
|
|
81
|
-
const schema = await import(
|
|
82
|
-
/* @vite-ignore */
|
|
83
|
-
schemaPath
|
|
84
|
-
);
|
|
85
|
-
for (const ext of extensions) await db.execute(`CREATE EXTENSION IF NOT EXISTS "${ext}"`);
|
|
86
|
-
await (await pushSchema(schema, db)).apply();
|
|
87
|
-
await reset(db, schema);
|
|
88
|
-
if (seedFunction) await seedFunction(db);
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
export { afterEach, beforeEach, describe, expect, initDb, seedDatabase, test, vi };
|
|
92
|
-
|
|
93
|
-
//# sourceMappingURL=db.mjs.map
|
package/dist/test/db.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db.mjs","names":["baseTest"],"sources":["../../src/test/db.ts"],"sourcesContent":["import { setupServer, type SetupServer } from 'msw/node'\nimport { existsSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { test as baseTest } from 'vite-plus/test'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type { Pool } from 'pg'\n\nconst DEFAULT_SCHEMA_PATH = 'src/db/tables.ts'\nconst DEFAULT_IMAGE = 'postgres:17'\nconst DEFAULT_EXTENSIONS = ['pg_trgm']\nconst ROOT_MARKERS = [\n\t'vite.config.ts',\n\t'vite.config.mts',\n\t'vite.config.js',\n\t'vite.config.mjs',\n\t'vitest.config.ts',\n\t'vitest.config.mts',\n\t'vitest.config.js',\n\t'vitest.config.mjs',\n]\n\nexport interface DbConfig {\n\troot?: string\n\tschemaPath?: string\n\tpostgresImage?: string\n}\n\nexport type Database = NodePgDatabase & {\n\t$client: Pool\n}\n\nexport interface DbFixture {\n\tserver: SetupServer\n\t_cleanup: void\n\tdb: Database\n\tseedFunction: (db: Database) => Promise<void> | void\n}\n\nlet dbConfig: DbConfig = {}\nlet mswServer: SetupServer | undefined\nlet seedFunction: (db: Database) => Promise<void> | void = async () => {}\n\nasync function ensureMswServer(): Promise<SetupServer> {\n\tif (!mswServer) {\n\t\tconst { default: handlers } = await import('@test/handlers')\n\t\tmswServer = setupServer(...handlers)\n\t}\n\treturn mswServer\n}\n\nfunction findProjectRoot(start = process.cwd()) {\n\tlet directory = start\n\n\twhile (true) {\n\t\tif (ROOT_MARKERS.some((marker) => existsSync(resolve(directory, marker)))) {\n\t\t\treturn directory\n\t\t}\n\n\t\tconst parent = dirname(directory)\n\t\tif (parent === directory) return start\n\t\tdirectory = parent\n\t}\n}\n\nexport const test = baseTest.extend<DbFixture>({\n\tserver: [\n\t\tasync ({}, use) => {\n\t\t\tconst server = await ensureMswServer()\n\t\t\tserver.listen({ onUnhandledRequest: 'bypass' })\n\t\t\tawait use(server)\n\t\t\tserver.close()\n\t\t},\n\t\t{ auto: true, scope: 'worker' },\n\t],\n\t_cleanup: [\n\t\tasync ({ server }, use) => {\n\t\t\tawait use()\n\t\t\tserver.resetHandlers()\n\t\t},\n\t\t{ auto: true },\n\t],\n\tseedFunction: [async ({}, use) => use(seedFunction), { scope: 'file' }],\n\tdb: [\n\t\tasync ({ seedFunction }, use) => {\n\t\t\tconst { PostgreSqlContainer } = await import('@testcontainers/postgresql')\n\t\t\tconst { drizzle } = await import('drizzle-orm/node-postgres')\n\t\t\tconst { Wait } = await import('testcontainers')\n\t\t\tconst { Pool } = await import('pg')\n\t\t\tconst root = dbConfig.root ?? findProjectRoot()\n\t\t\tconst schemaPath = resolve(\n\t\t\t\troot,\n\t\t\t\tdbConfig.schemaPath ?? DEFAULT_SCHEMA_PATH,\n\t\t\t)\n\t\t\tconst container = await new PostgreSqlContainer(\n\t\t\t\tdbConfig.postgresImage ?? DEFAULT_IMAGE,\n\t\t\t)\n\t\t\t\t.withWaitStrategy(Wait.forHealthCheck())\n\t\t\t\t.start()\n\t\t\tconst client = new Pool({\n\t\t\t\tconnectionString: container.getConnectionUri(),\n\t\t\t})\n\t\t\tconst db = Object.assign(drizzle({ client }), { $client: client })\n\n\t\t\ttry {\n\t\t\t\tawait seedDatabase(db, { schemaPath, seedFunction })\n\t\t\t\tawait use(db)\n\t\t\t} finally {\n\t\t\t\tawait db.$client.end()\n\t\t\t\tawait container.stop()\n\t\t\t}\n\t\t},\n\t\t{ scope: 'file' },\n\t],\n})\n\nexport { afterEach, beforeEach, describe, expect, vi } from 'vite-plus/test'\n\nexport function initDb(\n\tseed: (db: Database) => Promise<void> | void,\n\tconfig: DbConfig = {},\n) {\n\tdbConfig = config\n\tseedFunction = seed\n}\n\nexport interface SeedDatabaseOptions {\n\tschemaPath: string\n\tseedFunction?: (db: Database) => Promise<void> | void\n\textensions?: string[]\n}\n\nexport async function seedDatabase(\n\tdb: Database,\n\t{\n\t\tschemaPath,\n\t\tseedFunction,\n\t\textensions = DEFAULT_EXTENSIONS,\n\t}: SeedDatabaseOptions,\n) {\n\tconst { pushSchema } = await import('drizzle-kit/api')\n\tconst { reset } = await import('drizzle-seed')\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 (await pushSchema(schema, db)).apply()\n\tawait reset(db, schema)\n\tif (seedFunction) await seedFunction(db)\n}\n"],"mappings":";;;;;AAOA,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB;AACtB,MAAM,qBAAqB,CAAC,UAAU;AACtC,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAmBD,IAAI,WAAqB,EAAE;AAC3B,IAAI;AACJ,IAAI,eAAuD,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C,CAAC;EACF,MAAM,KAAK,OAAO,OAAO,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,QAAQ,CAAC;EAElE,IAAI;GACH,MAAM,aAAa,IAAI;IAAE;IAAY;IAAc,CAAC;GACpD,MAAM,IAAI,GAAG;YACJ;GACT,MAAM,GAAG,QAAQ,KAAK;GACtB,MAAM,UAAU,MAAM;;IAGxB,EAAE,OAAO,QAAQ,CACjB;CACD,CAAC;AAIF,SAAgB,OACf,MACA,SAAmB,EAAE,EACpB;CACD,WAAW;CACX,eAAe;;AAShB,eAAsB,aACrB,IACA,EACC,YACA,cACA,aAAa,sBAEb;CACD,MAAM,EAAE,eAAe,MAAM,OAAO;CACpC,MAAM,EAAE,UAAU,MAAM,OAAO;CAC/B,MAAM,SAAS,MAAM;;EAA0B;;CAE/C,KAAK,MAAM,OAAO,YACjB,MAAM,GAAG,QAAQ,mCAAmC,IAAI,GAAG;CAE5D,OAAO,MAAM,WAAW,QAAQ,GAAG,EAAE,OAAO;CAC5C,MAAM,MAAM,IAAI,OAAO;CACvB,IAAI,cAAc,MAAM,aAAa,GAAG"}
|
package/dist/test/server.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as _$vite_plus_test0 from "vite-plus/test";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, vi } from "vite-plus/test";
|
|
3
|
-
import { SetupServer } from "msw/node";
|
|
4
|
-
|
|
5
|
-
//#region src/test/server.d.ts
|
|
6
|
-
interface MswServerFixture {
|
|
7
|
-
server: SetupServer;
|
|
8
|
-
_cleanup: void;
|
|
9
|
-
}
|
|
10
|
-
declare const test: _$vite_plus_test0.TestAPI<{
|
|
11
|
-
server: SetupServer;
|
|
12
|
-
_cleanup: void;
|
|
13
|
-
}>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { MswServerFixture, afterEach, beforeEach, describe, expect, test, vi };
|
|
16
|
-
//# sourceMappingURL=server.d.mts.map
|
package/dist/test/server.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, test as test$1, vi } from "vite-plus/test";
|
|
2
|
-
import { setupServer } from "msw/node";
|
|
3
|
-
//#region src/test/server.ts
|
|
4
|
-
let mswServer;
|
|
5
|
-
async function ensureMswServer() {
|
|
6
|
-
if (!mswServer) {
|
|
7
|
-
const { default: handlers } = await import("@test/handlers");
|
|
8
|
-
mswServer = setupServer(...handlers);
|
|
9
|
-
}
|
|
10
|
-
return mswServer;
|
|
11
|
-
}
|
|
12
|
-
const test = test$1.extend({
|
|
13
|
-
server: [async ({}, use) => {
|
|
14
|
-
const server = await ensureMswServer();
|
|
15
|
-
server.listen({ onUnhandledRequest: "bypass" });
|
|
16
|
-
await use(server);
|
|
17
|
-
server.close();
|
|
18
|
-
}, {
|
|
19
|
-
auto: true,
|
|
20
|
-
scope: "worker"
|
|
21
|
-
}],
|
|
22
|
-
_cleanup: [async ({ server }, use) => {
|
|
23
|
-
await use();
|
|
24
|
-
server.resetHandlers();
|
|
25
|
-
}, { auto: true }]
|
|
26
|
-
});
|
|
27
|
-
//#endregion
|
|
28
|
-
export { afterEach, beforeEach, describe, expect, test, vi };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=server.mjs.map
|
package/dist/test/server.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["baseTest"],"sources":["../../src/test/server.ts"],"sourcesContent":["import { setupServer, type SetupServer } from 'msw/node'\nimport { test as baseTest } from 'vite-plus/test'\n\nexport interface MswServerFixture {\n\tserver: SetupServer\n\t_cleanup: void\n}\n\nlet mswServer: SetupServer | undefined\n\nasync function ensureMswServer(): Promise<SetupServer> {\n\tif (!mswServer) {\n\t\tconst { default: handlers } = await import('@test/handlers')\n\t\tmswServer = setupServer(...handlers)\n\t}\n\treturn mswServer\n}\n\nconst extended = baseTest.extend<MswServerFixture>({\n\tserver: [\n\t\tasync ({}, use) => {\n\t\t\tconst server = await ensureMswServer()\n\t\t\tserver.listen({ onUnhandledRequest: 'bypass' })\n\t\t\tawait use(server)\n\t\t\tserver.close()\n\t\t},\n\t\t{ auto: true, scope: 'worker' },\n\t],\n\t_cleanup: [\n\t\tasync ({ server }, use) => {\n\t\t\tawait use()\n\t\t\tserver.resetHandlers()\n\t\t},\n\t\t{ auto: true },\n\t],\n})\n\nexport { afterEach, beforeEach, describe, expect, vi } from 'vite-plus/test'\nexport const test = extended\n"],"mappings":";;;AAQA,IAAI;AAEJ,eAAe,kBAAwC;CACtD,IAAI,CAAC,WAAW;EACf,MAAM,EAAE,SAAS,aAAa,MAAM,OAAO;EAC3C,YAAY,YAAY,GAAG,SAAS;;CAErC,OAAO;;AAuBR,MAAa,OApBIA,OAAS,OAAyB;CAClD,QAAQ,CACP,OAAO,IAAI,QAAQ;EAClB,MAAM,SAAS,MAAM,iBAAiB;EACtC,OAAO,OAAO,EAAE,oBAAoB,UAAU,CAAC;EAC/C,MAAM,IAAI,OAAO;EACjB,OAAO,OAAO;IAEf;EAAE,MAAM;EAAM,OAAO;EAAU,CAC/B;CACD,UAAU,CACT,OAAO,EAAE,UAAU,QAAQ;EAC1B,MAAM,KAAK;EACX,OAAO,eAAe;IAEvB,EAAE,MAAM,MAAM,CACd;CACD,CAGmB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from "react";
|
|
2
|
-
import { render } from "vitest-browser-react";
|
|
3
|
-
|
|
4
|
-
//#region src/test/visual-page.d.ts
|
|
5
|
-
type ScreenshotOptions = {
|
|
6
|
-
component: ComponentType;
|
|
7
|
-
name: string;
|
|
8
|
-
waitFor: (screen: Awaited<ReturnType<typeof render>>) => HTMLElement | SVGElement | null;
|
|
9
|
-
prepare?: (screen: Awaited<ReturnType<typeof render>>) => void | Promise<void>;
|
|
10
|
-
setup?: () => void | Promise<void>;
|
|
11
|
-
target?: (screen: Awaited<ReturnType<typeof render>>) => HTMLElement;
|
|
12
|
-
fullPage?: boolean;
|
|
13
|
-
viewport?: {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
declare function expectComponentScreenshot({
|
|
19
|
-
component,
|
|
20
|
-
name,
|
|
21
|
-
waitFor,
|
|
22
|
-
prepare,
|
|
23
|
-
setup,
|
|
24
|
-
target,
|
|
25
|
-
fullPage,
|
|
26
|
-
viewport
|
|
27
|
-
}: ScreenshotOptions): Promise<void>;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { expectComponentScreenshot };
|
|
30
|
-
//# sourceMappingURL=visual-page.d.mts.map
|