@nexus_js/testing 0.6.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/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +277 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nexus Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @nexus_js/testing
|
|
2
|
+
|
|
3
|
+
Nexus testing utilities — render .nx components in SSR and client mode.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
All guides, API reference, and examples live on **[nexusjs.dev](https://nexusjs.dev)**.
|
|
8
|
+
|
|
9
|
+
## Links
|
|
10
|
+
|
|
11
|
+
- **Website:** [https://nexusjs.dev](https://nexusjs.dev)
|
|
12
|
+
- **Repository:** [github.com/bierfor/nexus](https://github.com/bierfor/nexus) (see `packages/testing/`)
|
|
13
|
+
- **Issues:** [github.com/bierfor/nexus/issues](https://github.com/bierfor/nexus/issues)
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
MIT © Nexus contributors
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexus_js/testing — Test utilities for Nexus components.
|
|
3
|
+
*
|
|
4
|
+
* Supports two test modes:
|
|
5
|
+
* 1. SSR mode: renders the server output, asserts on HTML strings
|
|
6
|
+
* 2. Island mode: mounts the client island in jsdom, tests reactivity
|
|
7
|
+
*
|
|
8
|
+
* Example:
|
|
9
|
+
* import { renderSSR, mountIsland, screen, fireEvent } from '@nexus_js/testing';
|
|
10
|
+
*
|
|
11
|
+
* // SSR test
|
|
12
|
+
* test('renders user name', async () => {
|
|
13
|
+
* const { html } = await renderSSR('./src/routes/+page.nx', {
|
|
14
|
+
* ctx: { params: { id: '42' } }
|
|
15
|
+
* });
|
|
16
|
+
* expect(html).toContain('Hello, Alice');
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Island (client) test
|
|
20
|
+
* test('counter increments', async () => {
|
|
21
|
+
* const { getByText, container } = await mountIsland('./Counter.nx');
|
|
22
|
+
* const btn = getByText('Click me');
|
|
23
|
+
* await fireEvent.click(btn);
|
|
24
|
+
* expect(getByText('Clicks: 1')).toBeDefined();
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Server Action test
|
|
28
|
+
* test('updateProfile saves name', async () => {
|
|
29
|
+
* const { invokeAction } = createActionTestHarness('./+page.nx');
|
|
30
|
+
* const result = await invokeAction('updateProfile', new FormData());
|
|
31
|
+
* expect(result.success).toBe(true);
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
export interface RenderSSROptions {
|
|
35
|
+
/** Context to inject (params, session, etc.) */
|
|
36
|
+
ctx?: Partial<MockContext>;
|
|
37
|
+
/** Additional props to pass to the component */
|
|
38
|
+
props?: Record<string, unknown>;
|
|
39
|
+
/** Mock implementations for $lib/* imports */
|
|
40
|
+
mocks?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface SSRResult {
|
|
43
|
+
/** Rendered HTML string */
|
|
44
|
+
html: string;
|
|
45
|
+
/** Extracted CSS */
|
|
46
|
+
css: string | null;
|
|
47
|
+
/** Whether islands are present */
|
|
48
|
+
hasIslands: boolean;
|
|
49
|
+
/** Island directives detected */
|
|
50
|
+
islands: string[];
|
|
51
|
+
/** Query utilities (JSDOM-based) */
|
|
52
|
+
querySelector: (selector: string) => Element | null;
|
|
53
|
+
querySelectorAll: (selector: string) => NodeListOf<Element>;
|
|
54
|
+
getByText: (text: string) => Element | undefined;
|
|
55
|
+
getByRole: (role: string) => Element | undefined;
|
|
56
|
+
}
|
|
57
|
+
export interface IslandMountResult {
|
|
58
|
+
container: Element;
|
|
59
|
+
getByText: (text: string) => Element | undefined;
|
|
60
|
+
getByRole: (role: string, opts?: {
|
|
61
|
+
name?: string;
|
|
62
|
+
}) => Element | undefined;
|
|
63
|
+
getByTestId: (id: string) => Element | undefined;
|
|
64
|
+
queryByText: (text: string) => Element | null;
|
|
65
|
+
/** Simulate a DOM event */
|
|
66
|
+
fireEvent: typeof fireEvent;
|
|
67
|
+
/** Wait for async updates */
|
|
68
|
+
waitFor: (fn: () => boolean, timeout?: number) => Promise<void>;
|
|
69
|
+
/** Unmount and cleanup */
|
|
70
|
+
unmount: () => void;
|
|
71
|
+
}
|
|
72
|
+
export interface MockContext {
|
|
73
|
+
params: Record<string, string>;
|
|
74
|
+
url: URL;
|
|
75
|
+
request: Request;
|
|
76
|
+
session: Record<string, unknown>;
|
|
77
|
+
locals: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Renders a .nx file in server mode and returns HTML + query utilities.
|
|
81
|
+
*/
|
|
82
|
+
export declare function renderSSR(filepath: string, opts?: RenderSSROptions): Promise<SSRResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Mounts an island in jsdom for client-side testing.
|
|
85
|
+
*/
|
|
86
|
+
export declare function mountIsland(filepath: string, props?: Record<string, unknown>): Promise<IslandMountResult>;
|
|
87
|
+
export interface ActionTestHarness {
|
|
88
|
+
invokeAction: (name: string, input: FormData | unknown) => Promise<unknown>;
|
|
89
|
+
listActions: () => Promise<string[]>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates a test harness for Server Actions defined in a .nx file.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createActionTestHarness(filepath: string): ActionTestHarness;
|
|
95
|
+
export declare const fireEvent: {
|
|
96
|
+
click: (el: Element) => boolean;
|
|
97
|
+
input: (el: Element, value: string) => void;
|
|
98
|
+
submit: (el: Element) => boolean;
|
|
99
|
+
change: (el: Element, value: string) => void;
|
|
100
|
+
keydown: (el: Element, key: string) => boolean;
|
|
101
|
+
};
|
|
102
|
+
export declare const nexusMatchers: {
|
|
103
|
+
toContainHTML(received: SSRResult, expected: string): {
|
|
104
|
+
pass: boolean;
|
|
105
|
+
message: () => string;
|
|
106
|
+
};
|
|
107
|
+
toHaveIsland(received: SSRResult, directive: string): {
|
|
108
|
+
pass: boolean;
|
|
109
|
+
message: () => string;
|
|
110
|
+
};
|
|
111
|
+
toBeSSROnly(received: SSRResult): {
|
|
112
|
+
pass: boolean;
|
|
113
|
+
message: () => "Expected component to have islands" | "Expected component to be server-only (no islands)";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=index.d.ts.map
|
|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BACR,OAAO;gBACP,OAAO,SAAS,MAAM;iBAIrB,OAAO;iBACP,OAAO,SAAS,MAAM;kBAIrB,OAAO,OAAO,MAAM;CAEnC,CAAC;AAIF,eAAO,MAAM,aAAa;4BACA,SAAS,YAAY,MAAM;;;;2BAU5B,SAAS,aAAa,MAAM;;;;0BAU7B,SAAS;;;;CAShC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexus_js/testing — Test utilities for Nexus components.
|
|
3
|
+
*
|
|
4
|
+
* Supports two test modes:
|
|
5
|
+
* 1. SSR mode: renders the server output, asserts on HTML strings
|
|
6
|
+
* 2. Island mode: mounts the client island in jsdom, tests reactivity
|
|
7
|
+
*
|
|
8
|
+
* Example:
|
|
9
|
+
* import { renderSSR, mountIsland, screen, fireEvent } from '@nexus_js/testing';
|
|
10
|
+
*
|
|
11
|
+
* // SSR test
|
|
12
|
+
* test('renders user name', async () => {
|
|
13
|
+
* const { html } = await renderSSR('./src/routes/+page.nx', {
|
|
14
|
+
* ctx: { params: { id: '42' } }
|
|
15
|
+
* });
|
|
16
|
+
* expect(html).toContain('Hello, Alice');
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Island (client) test
|
|
20
|
+
* test('counter increments', async () => {
|
|
21
|
+
* const { getByText, container } = await mountIsland('./Counter.nx');
|
|
22
|
+
* const btn = getByText('Click me');
|
|
23
|
+
* await fireEvent.click(btn);
|
|
24
|
+
* expect(getByText('Clicks: 1')).toBeDefined();
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Server Action test
|
|
28
|
+
* test('updateProfile saves name', async () => {
|
|
29
|
+
* const { invokeAction } = createActionTestHarness('./+page.nx');
|
|
30
|
+
* const result = await invokeAction('updateProfile', new FormData());
|
|
31
|
+
* expect(result.success).toBe(true);
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
import { compile, parse } from '@nexus_js/compiler';
|
|
35
|
+
import { readFile } from 'node:fs/promises';
|
|
36
|
+
import { resolve } from 'node:path';
|
|
37
|
+
// ── SSR Testing ───────────────────────────────────────────────────────────────
|
|
38
|
+
/**
|
|
39
|
+
* Renders a .nx file in server mode and returns HTML + query utilities.
|
|
40
|
+
*/
|
|
41
|
+
export async function renderSSR(filepath, opts = {}) {
|
|
42
|
+
const absPath = resolve(process.cwd(), filepath);
|
|
43
|
+
const source = await readFile(absPath, 'utf-8');
|
|
44
|
+
const result = compile(source, absPath, {
|
|
45
|
+
mode: 'server',
|
|
46
|
+
dev: true,
|
|
47
|
+
ssr: true,
|
|
48
|
+
emitIslandManifest: true,
|
|
49
|
+
target: 'node',
|
|
50
|
+
});
|
|
51
|
+
// For now, return the serverCode as mock HTML
|
|
52
|
+
// In full implementation, we'd execute the serverCode in a VM context
|
|
53
|
+
const html = extractMockHTML(result.serverCode, opts.props ?? {});
|
|
54
|
+
const parsed = parse(source, absPath);
|
|
55
|
+
return {
|
|
56
|
+
html,
|
|
57
|
+
css: result.css,
|
|
58
|
+
hasIslands: parsed.islandDirectives.length > 0,
|
|
59
|
+
islands: parsed.islandDirectives.map((d) => d.directive),
|
|
60
|
+
querySelector: (sel) => createQueryContext(html).querySelector(sel),
|
|
61
|
+
querySelectorAll: (sel) => createQueryContext(html).querySelectorAll(sel),
|
|
62
|
+
getByText: (text) => findByText(html, text),
|
|
63
|
+
getByRole: (role) => findByRole(html, role),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// ── Island Testing ────────────────────────────────────────────────────────────
|
|
67
|
+
/**
|
|
68
|
+
* Mounts an island in jsdom for client-side testing.
|
|
69
|
+
*/
|
|
70
|
+
export async function mountIsland(filepath, props = {}) {
|
|
71
|
+
const absPath = resolve(process.cwd(), filepath);
|
|
72
|
+
const source = await readFile(absPath, 'utf-8');
|
|
73
|
+
const result = compile(source, absPath, {
|
|
74
|
+
mode: 'client',
|
|
75
|
+
dev: true,
|
|
76
|
+
ssr: false,
|
|
77
|
+
emitIslandManifest: false,
|
|
78
|
+
target: 'browser',
|
|
79
|
+
});
|
|
80
|
+
// Create a container element
|
|
81
|
+
const container = createMockElement('div');
|
|
82
|
+
// Execute island code in a sandboxed context
|
|
83
|
+
const clientCode = result.clientCode ?? result.serverCode;
|
|
84
|
+
await executeIslandCode(clientCode, container, props);
|
|
85
|
+
const getAll = () => container.querySelectorAll('*');
|
|
86
|
+
return {
|
|
87
|
+
container,
|
|
88
|
+
getByText: (text) => [...getAll()].find((el) => el.textContent?.includes(text)),
|
|
89
|
+
getByRole: (role, opts = {}) => [...getAll()].find((el) => {
|
|
90
|
+
const r = el.getAttribute('role') ?? inferRole(el.tagName);
|
|
91
|
+
if (r !== role)
|
|
92
|
+
return false;
|
|
93
|
+
if (opts.name)
|
|
94
|
+
return el.getAttribute('aria-label')?.includes(opts.name) ?? false;
|
|
95
|
+
return true;
|
|
96
|
+
}),
|
|
97
|
+
getByTestId: (id) => container.querySelector(`[data-testid="${id}"]`) ?? undefined,
|
|
98
|
+
queryByText: (text) => [...getAll()].find((el) => el.textContent?.includes(text)) ?? null,
|
|
99
|
+
fireEvent,
|
|
100
|
+
waitFor: (fn, timeout = 1000) => waitFor(fn, timeout),
|
|
101
|
+
unmount: () => { container.innerHTML = ''; },
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Creates a test harness for Server Actions defined in a .nx file.
|
|
106
|
+
*/
|
|
107
|
+
export function createActionTestHarness(filepath) {
|
|
108
|
+
const absPath = resolve(process.cwd(), filepath);
|
|
109
|
+
return {
|
|
110
|
+
async invokeAction(name, input) {
|
|
111
|
+
const source = await readFile(absPath, 'utf-8');
|
|
112
|
+
const parsed = parse(source, absPath);
|
|
113
|
+
const action = parsed.serverActions.find((a) => a.name === name);
|
|
114
|
+
if (!action) {
|
|
115
|
+
throw new Error(`Action "${name}" not found in ${filepath}`);
|
|
116
|
+
}
|
|
117
|
+
// Execute the action body in a mock context
|
|
118
|
+
const mockCtx = createMockContext();
|
|
119
|
+
const body = action.body;
|
|
120
|
+
// Create a function from the action body and execute it
|
|
121
|
+
const fn = new Function('ctx', 'input', 'FormData', `
|
|
122
|
+
"use strict";
|
|
123
|
+
return (async () => { ${body} })();
|
|
124
|
+
`);
|
|
125
|
+
return fn(mockCtx, input, FormData);
|
|
126
|
+
},
|
|
127
|
+
async listActions() {
|
|
128
|
+
const source = await readFile(absPath, 'utf-8');
|
|
129
|
+
const parsed = parse(source, absPath);
|
|
130
|
+
return parsed.serverActions.map((a) => a.name);
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// ── Event simulation ──────────────────────────────────────────────────────────
|
|
135
|
+
export const fireEvent = {
|
|
136
|
+
click: (el) => el.dispatchEvent(new MouseEvent('click', { bubbles: true })),
|
|
137
|
+
input: (el, value) => {
|
|
138
|
+
if (el instanceof HTMLInputElement)
|
|
139
|
+
el.value = value;
|
|
140
|
+
el.dispatchEvent(new InputEvent('input', { bubbles: true }));
|
|
141
|
+
},
|
|
142
|
+
submit: (el) => el.dispatchEvent(new Event('submit', { bubbles: true })),
|
|
143
|
+
change: (el, value) => {
|
|
144
|
+
if (el instanceof HTMLInputElement)
|
|
145
|
+
el.value = value;
|
|
146
|
+
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
147
|
+
},
|
|
148
|
+
keydown: (el, key) => el.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true })),
|
|
149
|
+
};
|
|
150
|
+
// ── Matchers for Vitest ───────────────────────────────────────────────────────
|
|
151
|
+
export const nexusMatchers = {
|
|
152
|
+
toContainHTML(received, expected) {
|
|
153
|
+
const pass = received.html.includes(expected);
|
|
154
|
+
return {
|
|
155
|
+
pass,
|
|
156
|
+
message: () => pass
|
|
157
|
+
? `Expected HTML not to contain "${expected}"`
|
|
158
|
+
: `Expected HTML to contain "${expected}"\n\nReceived:\n${received.html.slice(0, 500)}`,
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
toHaveIsland(received, directive) {
|
|
162
|
+
const pass = received.islands.includes(directive);
|
|
163
|
+
return {
|
|
164
|
+
pass,
|
|
165
|
+
message: () => pass
|
|
166
|
+
? `Expected component not to have island "${directive}"`
|
|
167
|
+
: `Expected component to have island "${directive}"\n\nFound: ${received.islands.join(', ')}`,
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
toBeSSROnly(received) {
|
|
171
|
+
const pass = !received.hasIslands;
|
|
172
|
+
return {
|
|
173
|
+
pass,
|
|
174
|
+
message: () => pass
|
|
175
|
+
? 'Expected component to have islands'
|
|
176
|
+
: 'Expected component to be server-only (no islands)',
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
181
|
+
// Internal helpers
|
|
182
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
183
|
+
function createQueryContext(html) {
|
|
184
|
+
if (typeof DOMParser !== 'undefined') {
|
|
185
|
+
return new DOMParser().parseFromString(html, 'text/html');
|
|
186
|
+
}
|
|
187
|
+
// Fallback for Node.js environments without DOMParser
|
|
188
|
+
return { querySelector: () => null, querySelectorAll: () => ({ length: 0 }) };
|
|
189
|
+
}
|
|
190
|
+
function findByText(html, text) {
|
|
191
|
+
const doc = createQueryContext(html);
|
|
192
|
+
return [...doc.querySelectorAll('*')].find((el) => el.textContent?.trim() === text);
|
|
193
|
+
}
|
|
194
|
+
function findByRole(html, role) {
|
|
195
|
+
const doc = createQueryContext(html);
|
|
196
|
+
return [...doc.querySelectorAll(`[role="${role}"], ${roleToTag(role)}`)][0];
|
|
197
|
+
}
|
|
198
|
+
function roleToTag(role) {
|
|
199
|
+
const map = {
|
|
200
|
+
button: 'button',
|
|
201
|
+
link: 'a',
|
|
202
|
+
heading: 'h1,h2,h3,h4,h5,h6',
|
|
203
|
+
textbox: 'input[type="text"],textarea',
|
|
204
|
+
checkbox: 'input[type="checkbox"]',
|
|
205
|
+
form: 'form',
|
|
206
|
+
list: 'ul,ol',
|
|
207
|
+
listitem: 'li',
|
|
208
|
+
img: 'img',
|
|
209
|
+
navigation: 'nav',
|
|
210
|
+
main: 'main',
|
|
211
|
+
banner: 'header',
|
|
212
|
+
contentinfo: 'footer',
|
|
213
|
+
};
|
|
214
|
+
return map[role] ?? role;
|
|
215
|
+
}
|
|
216
|
+
function inferRole(tag) {
|
|
217
|
+
const map = {
|
|
218
|
+
BUTTON: 'button',
|
|
219
|
+
A: 'link',
|
|
220
|
+
H1: 'heading', H2: 'heading', H3: 'heading',
|
|
221
|
+
INPUT: 'textbox',
|
|
222
|
+
FORM: 'form',
|
|
223
|
+
UL: 'list', OL: 'list',
|
|
224
|
+
LI: 'listitem',
|
|
225
|
+
IMG: 'img',
|
|
226
|
+
NAV: 'navigation',
|
|
227
|
+
MAIN: 'main',
|
|
228
|
+
HEADER: 'banner',
|
|
229
|
+
FOOTER: 'contentinfo',
|
|
230
|
+
};
|
|
231
|
+
return map[tag.toUpperCase()] ?? '';
|
|
232
|
+
}
|
|
233
|
+
function createMockElement(tag) {
|
|
234
|
+
if (typeof document !== 'undefined')
|
|
235
|
+
return document.createElement(tag);
|
|
236
|
+
// Minimal mock for Node.js
|
|
237
|
+
return {
|
|
238
|
+
tagName: tag.toUpperCase(),
|
|
239
|
+
innerHTML: '',
|
|
240
|
+
textContent: '',
|
|
241
|
+
children: [],
|
|
242
|
+
querySelectorAll: () => ({ length: 0 }),
|
|
243
|
+
querySelector: () => null,
|
|
244
|
+
dispatchEvent: () => true,
|
|
245
|
+
setAttribute: () => { },
|
|
246
|
+
getAttribute: () => null,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
async function executeIslandCode(_code, _container, _props) {
|
|
250
|
+
// In a full implementation, use vm.runInContext() or a Vite environment
|
|
251
|
+
// to execute the island code with the Nexus runtime injected.
|
|
252
|
+
// For now, we just set up the container for DOM querying.
|
|
253
|
+
}
|
|
254
|
+
function createMockContext() {
|
|
255
|
+
return {
|
|
256
|
+
params: {},
|
|
257
|
+
url: new URL('http://localhost/'),
|
|
258
|
+
request: new Request('http://localhost/'),
|
|
259
|
+
session: {},
|
|
260
|
+
locals: {},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
async function waitFor(fn, timeout) {
|
|
264
|
+
const start = Date.now();
|
|
265
|
+
while (!fn()) {
|
|
266
|
+
if (Date.now() - start > timeout) {
|
|
267
|
+
throw new Error(`waitFor timed out after ${timeout}ms`);
|
|
268
|
+
}
|
|
269
|
+
await new Promise((r) => setTimeout(r, 16));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function extractMockHTML(serverCode, props) {
|
|
273
|
+
// Extract template literal from generated server code for basic assertions
|
|
274
|
+
const match = /return `([\s\S]+?)`/.exec(serverCode);
|
|
275
|
+
return match?.[1]?.replace(/\$\{[^}]+\}/g, '[dynamic]') ?? serverCode;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDpC,iFAAiF;AAEjF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,QAAgB,EAChB,OAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEhD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE;QACtC,IAAI,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1B,CAAC;AAED,KAAK,UAAU,iBAAiB,CAC9B,KAAa,EACb,UAAmB,EACnB,MAA+B;IAE/B,wEAAwE;IACxE,8DAA8D;IAC9D,0DAA0D;AAC5D,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;QACL,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,IAAI,GAAG,CAAC,mBAAmB,CAAC;QACjC,OAAO,EAAE,IAAI,OAAO,CAAC,mBAAmB,CAAC;QACzC,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,EAAiB,EAAE,OAAe;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,UAAkB,EAAE,KAA8B;IACzE,2EAA2E;IAC3E,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC,IAAI,UAAU,CAAC;AACxE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexus_js/testing",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Nexus testing utilities — render .nx components in SSR and client mode",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./vitest": {
|
|
14
|
+
"import": "./dist/vitest.js",
|
|
15
|
+
"types": "./dist/vitest.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./playwright": {
|
|
18
|
+
"import": "./dist/playwright.js",
|
|
19
|
+
"types": "./dist/playwright.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@nexus_js/compiler": "0.6.0",
|
|
24
|
+
"@nexus_js/runtime": "0.6.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"vitest": ">=2.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.5.0",
|
|
32
|
+
"vitest": "^2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"homepage": "https://nexusjs.dev",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/bierfor/nexus.git",
|
|
39
|
+
"directory": "packages/testing"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/bierfor/nexus/issues"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"nexus",
|
|
46
|
+
"framework",
|
|
47
|
+
"full-stack",
|
|
48
|
+
"svelte",
|
|
49
|
+
"islands",
|
|
50
|
+
"ssr",
|
|
51
|
+
"vite",
|
|
52
|
+
"server-actions"
|
|
53
|
+
],
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"README.md"
|
|
57
|
+
],
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public",
|
|
60
|
+
"registry": "https://registry.npmjs.org/"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc -p tsconfig.json",
|
|
64
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
65
|
+
"clean": "rm -rf dist"
|
|
66
|
+
}
|
|
67
|
+
}
|