@noma.to/qwik-testing-library 1.0.3 → 1.1.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 +120 -7
- package/lib/_virtual/_commonjsHelpers.qwik.cjs +2 -0
- package/lib/_virtual/_commonjsHelpers.qwik.mjs +2 -0
- package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +4 -0
- package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +4 -0
- package/lib/index.qwik.cjs +4 -0
- package/lib/index.qwik.mjs +4 -0
- package/lib/lib/mock.qwik.cjs +14 -0
- package/lib/lib/mock.qwik.mjs +14 -0
- package/lib/lib/qwik-testing-library.qwik.cjs +4 -0
- package/lib/lib/qwik-testing-library.qwik.mjs +4 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +425 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +425 -0
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.cjs +1967 -0
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.mjs +1967 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1202 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1202 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.cjs +665 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.mjs +665 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.cjs +1641 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.mjs +1641 -0
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.cjs +148 -0
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.mjs +148 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs +158 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs +158 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.cjs +1731 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.mjs +1731 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +81 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +81 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.cjs +216 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.mjs +216 -0
- package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.cjs +3905 -0
- package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.mjs +3905 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.cjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.mjs +13 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.cjs +30 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.mjs +31 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.cjs +11 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.mjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.cjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.mjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.cjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.cjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.mjs +26 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.cjs +19 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.mjs +20 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.cjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.mjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.cjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.mjs +18 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.cjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.mjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.cjs +968 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.mjs +968 -0
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +101 -0
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +101 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +7 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +8 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +6 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +6 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +16 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +2556 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +2556 -0
- package/lib-types/lib/mock.d.ts +34 -0
- package/lib-types/lib/qwik-testing-library.d.ts +2 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ src="https://raw.githubusercontent.com/ianlet/qwik-testing-library/main/high-vol
|
|
|
37
37
|
|
|
38
38
|
[qtl-docs-repo]: https://github.com/ianlet/qwik-testing-library/blob/main/README.md
|
|
39
39
|
|
|
40
|
-
[build-badge]: https://img.shields.io/github/actions/workflow/status/ianlet/qwik-testing-library/
|
|
40
|
+
[build-badge]: https://img.shields.io/github/actions/workflow/status/ianlet/qwik-testing-library/ci.yml?style=flat-square
|
|
41
41
|
|
|
42
42
|
[build]: https://github.com/ianlet/qwik-testing-library/actions
|
|
43
43
|
|
|
@@ -91,12 +91,14 @@ src="https://raw.githubusercontent.com/ianlet/qwik-testing-library/main/high-vol
|
|
|
91
91
|
- [Installation](#installation)
|
|
92
92
|
- [Setup](#setup)
|
|
93
93
|
- [Examples](#examples)
|
|
94
|
-
|
|
94
|
+
- [Qwikstart](#qwikstart)
|
|
95
|
+
- [Mocking Component Callbacks (experimental)](#mocking-component-callbacks-experimental)
|
|
96
|
+
- [Qwik City - `server$` calls](#qwik-city---server-calls)
|
|
95
97
|
- [Gotchas](#gotchas)
|
|
96
98
|
- [Issues](#issues)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
- [🐛 Bugs](#-bugs)
|
|
100
|
+
- [💡 Feature Requests](#-feature-requests)
|
|
101
|
+
- [❓ Questions](#-questions)
|
|
100
102
|
- [Contributors](#contributors)
|
|
101
103
|
- [Acknowledgements](#acknowledgements)
|
|
102
104
|
|
|
@@ -131,7 +133,7 @@ npm install --save-dev @noma.to/qwik-testing-library
|
|
|
131
133
|
|
|
132
134
|
This library supports `qwik` versions `1.7.2` and above.
|
|
133
135
|
|
|
134
|
-
You may also be interested in installing `@testing-library/jest-dom` so you can
|
|
136
|
+
You may also be interested in installing `@testing-library/jest-dom` and `@testing-library/user-event` so you can
|
|
135
137
|
use [the custom jest matchers][jest-dom] and [the user event library][user-event] to test interactions with the DOM.
|
|
136
138
|
|
|
137
139
|
```shell
|
|
@@ -278,6 +280,8 @@ This is a minimal setup to get you started, with line-by-line explanations.
|
|
|
278
280
|
|
|
279
281
|
// import qwik-testing methods
|
|
280
282
|
import {screen, render, waitFor} from "@noma.to/qwik-testing-library";
|
|
283
|
+
// import the userEvent methods to interact with the DOM
|
|
284
|
+
import {userEvent} from "@testing-library/user-event";
|
|
281
285
|
// import the component to be tested
|
|
282
286
|
import {Counter} from "./counter";
|
|
283
287
|
|
|
@@ -294,12 +298,121 @@ describe("<Counter />", () => {
|
|
|
294
298
|
await userEvent.click(incrementBtn);
|
|
295
299
|
await userEvent.click(incrementBtn);
|
|
296
300
|
|
|
297
|
-
// assert that the counter is now
|
|
301
|
+
// assert that the counter is now 2
|
|
298
302
|
await waitFor(() => expect(screen.getByText(/count:2/)).toBeInTheDocument());
|
|
299
303
|
});
|
|
300
304
|
})
|
|
301
305
|
```
|
|
302
306
|
|
|
307
|
+
### Mocking Component Callbacks (experimental)
|
|
308
|
+
|
|
309
|
+
> [!WARNING]
|
|
310
|
+
> This feature is under a testing phase and thus experimental.
|
|
311
|
+
> Its API may change in the future, so use it at your own risk.
|
|
312
|
+
|
|
313
|
+
The Qwik Testing Library provides a `mock$` function
|
|
314
|
+
that can be used to create a mock of a QRL and verify interactions on your Qwik components.
|
|
315
|
+
|
|
316
|
+
It is _not_ a replacement of regular mocking functions (such as `vi.fn` and `vi.mock`) as its intended use is only for
|
|
317
|
+
testing callbacks of Qwik components.
|
|
318
|
+
|
|
319
|
+
Here's an example on how to use the `mock$` function:
|
|
320
|
+
|
|
321
|
+
```tsx title="counter.spec.tsx"
|
|
322
|
+
// import qwik-testing methods
|
|
323
|
+
import {mock$, clearAllMock, render, screen, waitFor} from "@noma.to/qwik-testing-library";
|
|
324
|
+
// import the userEvent methods to interact with the DOM
|
|
325
|
+
import userEvent from "@testing-library/user-event";
|
|
326
|
+
|
|
327
|
+
// import the component to be tested
|
|
328
|
+
import {Counter} from "./counter";
|
|
329
|
+
|
|
330
|
+
// describe the test suite
|
|
331
|
+
describe("<Counter />", () => {
|
|
332
|
+
// initialize a mock
|
|
333
|
+
// note: the empty callback is required but currently unused
|
|
334
|
+
const onChangeMock = mock$(() => {
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// setup beforeEach block to run before each test
|
|
338
|
+
beforeEach(() => {
|
|
339
|
+
// remember to always clear all mocks before each test
|
|
340
|
+
clearAllMocks();
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// describe the 'on increment' test cases
|
|
344
|
+
describe("on increment", () => {
|
|
345
|
+
// describe the test case
|
|
346
|
+
it("should call onChange$", async () => {
|
|
347
|
+
// render the component into the DOM
|
|
348
|
+
await render(<Counter value={0} onChange$={onChangeMock}/>);
|
|
349
|
+
|
|
350
|
+
// retrieve the 'decrement' button
|
|
351
|
+
const decrementBtn = screen.getByRole("button", {name: "Decrement"});
|
|
352
|
+
// click the button
|
|
353
|
+
await userEvent.click(decrementBtn);
|
|
354
|
+
|
|
355
|
+
// assert that the onChange$ callback was called with the right value
|
|
356
|
+
// note: QRLs are async in Qwik, so we need to resolve them to verify interactions
|
|
357
|
+
await waitFor(() =>
|
|
358
|
+
expect(onChangeMock.resolve()).resolves.toHaveBeenCalledWith(-1),
|
|
359
|
+
);
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
})
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Qwik City - `server$` calls
|
|
366
|
+
|
|
367
|
+
If one of your Qwik components uses `server$` calls, your tests might fail with a rather cryptic message (e.g. `QWIK
|
|
368
|
+
ERROR __vite_ssr_import_0__.myServerFunctionQrl is not a function` or
|
|
369
|
+
`QWIK ERROR Failed to parse URL from ?qfunc=DNpotUma33o`).
|
|
370
|
+
|
|
371
|
+
We're happy to discuss it on [Discord][discord], but we consider this failure to be a good thing:
|
|
372
|
+
your components should be tested in isolation, so you will be forced to mock your server functions.
|
|
373
|
+
|
|
374
|
+
Here is an example of how to test a component that uses `server$` calls:
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
// ~/server/blog-posts.ts
|
|
378
|
+
|
|
379
|
+
import {server$} from "@builder.io/qwik-city";
|
|
380
|
+
import {BlogPost} from "~/lib/blog-post";
|
|
381
|
+
|
|
382
|
+
export const getLatestPosts$ = server$(function (): Promise<BlogPost> {
|
|
383
|
+
// get the latest posts
|
|
384
|
+
return Promise.resolve([]);
|
|
385
|
+
});
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
// ~/components/latest-post-list.spec.tsx
|
|
390
|
+
|
|
391
|
+
import {render, screen, waitFor} from "@noma.to/qwik-testing-library";
|
|
392
|
+
import {LatestPostList} from "./latest-post-list";
|
|
393
|
+
|
|
394
|
+
vi.mock('~/server/blog-posts', () => ({
|
|
395
|
+
// the mocked function should end with `Qrl` instead of `$`
|
|
396
|
+
getLatestPostsQrl: () => {
|
|
397
|
+
return Promise.resolve([{id: 'post-1', title: 'Post 1'}, {id: 'post-2', title: 'Post 2'}]);
|
|
398
|
+
},
|
|
399
|
+
}));
|
|
400
|
+
|
|
401
|
+
describe('<LatestPostList />', () => {
|
|
402
|
+
it('should render the latest posts', async () => {
|
|
403
|
+
await render(<LatestPostList/>);
|
|
404
|
+
|
|
405
|
+
await waitFor(() => expect(screen.queryAllByRole('listitem')).toHaveLength(2));
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Notice how the mocked function is ending with `Qrl` instead of `$`, despite being named as `getLatestPosts$`.
|
|
411
|
+
This is caused by the Qwik optimizer renaming it to `Qrl`.
|
|
412
|
+
So, we need to mock the `Qrl` function instead of the original `$` one.
|
|
413
|
+
|
|
414
|
+
If your `server$` function doesn't end with `$`, the Qwik optimizer might not rename it to `Qrl`.
|
|
415
|
+
|
|
303
416
|
## Gotchas
|
|
304
417
|
|
|
305
418
|
* Watch mode (at least in Webstorm) doesn't seem to work well: components are not being updated with your latest changes
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
3
4
|
function getDefaultExportFromCjs(x) {
|
|
4
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
6
|
}
|
|
7
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
6
8
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1
2
|
function getDefaultExportFromCjs(x) {
|
|
2
3
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
3
4
|
}
|
|
4
5
|
export {
|
|
6
|
+
commonjsGlobal,
|
|
5
7
|
getDefaultExportFromCjs
|
|
6
8
|
};
|
package/lib/index.qwik.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const qwikTestingLibrary = require("./lib/qwik-testing-library.qwik.cjs");
|
|
4
4
|
const index = require("./node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.qwik.cjs");
|
|
5
5
|
const dom_esm = require("./node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.cjs");
|
|
6
|
+
const mock = require("./lib/mock.qwik.cjs");
|
|
6
7
|
exports.cleanup = qwikTestingLibrary.cleanup;
|
|
7
8
|
exports.render = qwikTestingLibrary.render;
|
|
8
9
|
exports.prettyFormat = index;
|
|
@@ -83,3 +84,6 @@ exports.waitForElementToBeRemoved = dom_esm.waitForElementToBeRemoved;
|
|
|
83
84
|
exports.within = dom_esm.getQueriesForElement;
|
|
84
85
|
exports.wrapAllByQueryWithSuggestion = dom_esm.wrapAllByQueryWithSuggestion;
|
|
85
86
|
exports.wrapSingleQueryWithSuggestion = dom_esm.wrapSingleQueryWithSuggestion;
|
|
87
|
+
exports.clearAllMocks = mock.clearAllMocks;
|
|
88
|
+
exports.mock$ = mock.mock$;
|
|
89
|
+
exports.mockQrl = mock.mockQrl;
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { cleanup, render } from "./lib/qwik-testing-library.qwik.mjs";
|
|
2
2
|
import * as index from "./node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.qwik.mjs";
|
|
3
3
|
import { buildQueries, configure, createEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getMultipleElementsFoundError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, makeFindQuery, makeGetAllQuery, makeSingleQuery, prettyDOM, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, getQueriesForElement as getQueriesForElement2, wrapAllByQueryWithSuggestion, wrapSingleQueryWithSuggestion } from "./node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
|
|
4
|
+
import { clearAllMocks, mock$, mockQrl } from "./lib/mock.qwik.mjs";
|
|
4
5
|
export {
|
|
5
6
|
buildQueries,
|
|
6
7
|
cleanup,
|
|
8
|
+
clearAllMocks,
|
|
7
9
|
configure,
|
|
8
10
|
createEvent,
|
|
9
11
|
findAllByAltText,
|
|
@@ -53,6 +55,8 @@ export {
|
|
|
53
55
|
makeFindQuery,
|
|
54
56
|
makeGetAllQuery,
|
|
55
57
|
makeSingleQuery,
|
|
58
|
+
mock$,
|
|
59
|
+
mockQrl,
|
|
56
60
|
prettyDOM,
|
|
57
61
|
index as prettyFormat,
|
|
58
62
|
queries,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const vi_D6IHiKAI = require("../node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs");
|
|
5
|
+
const mockQrl = () => {
|
|
6
|
+
return qwik.$(vi_D6IHiKAI.v.fn());
|
|
7
|
+
};
|
|
8
|
+
const mock$ = qwik.implicit$FirstArg(mockQrl);
|
|
9
|
+
function clearAllMocks() {
|
|
10
|
+
vi_D6IHiKAI.v.clearAllMocks();
|
|
11
|
+
}
|
|
12
|
+
exports.clearAllMocks = clearAllMocks;
|
|
13
|
+
exports.mock$ = mock$;
|
|
14
|
+
exports.mockQrl = mockQrl;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { implicit$FirstArg, $ } from "@builder.io/qwik";
|
|
2
|
+
import { v as vi } from "../node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs";
|
|
3
|
+
const mockQrl = () => {
|
|
4
|
+
return $(vi.fn());
|
|
5
|
+
};
|
|
6
|
+
const mock$ = implicit$FirstArg(mockQrl);
|
|
7
|
+
function clearAllMocks() {
|
|
8
|
+
vi.clearAllMocks();
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
clearAllMocks,
|
|
12
|
+
mock$,
|
|
13
|
+
mockQrl
|
|
14
|
+
};
|
|
@@ -25,6 +25,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
25
25
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
26
26
|
const dom_esm = require("../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.cjs");
|
|
27
27
|
const qwikloader = require("./qwikloader.qwik.cjs");
|
|
28
|
+
const mock = require("./mock.qwik.cjs");
|
|
28
29
|
const mountedContainers = /* @__PURE__ */ new Set();
|
|
29
30
|
async function render(ui, options = {}) {
|
|
30
31
|
const qwik = await import("@builder.io/qwik");
|
|
@@ -155,5 +156,8 @@ exports.waitForElementToBeRemoved = dom_esm.waitForElementToBeRemoved;
|
|
|
155
156
|
exports.within = dom_esm.getQueriesForElement;
|
|
156
157
|
exports.wrapAllByQueryWithSuggestion = dom_esm.wrapAllByQueryWithSuggestion;
|
|
157
158
|
exports.wrapSingleQueryWithSuggestion = dom_esm.wrapSingleQueryWithSuggestion;
|
|
159
|
+
exports.clearAllMocks = mock.clearAllMocks;
|
|
160
|
+
exports.mock$ = mock.mock$;
|
|
161
|
+
exports.mockQrl = mock.mockQrl;
|
|
158
162
|
exports.cleanup = cleanup;
|
|
159
163
|
exports.render = render;
|
|
@@ -2,6 +2,7 @@ import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
|
2
2
|
import { prettyDOM, getQueriesForElement } from "../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
|
|
3
3
|
import { buildQueries, configure, createEvent, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getMultipleElementsFoundError, getNodeText, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, makeFindQuery, makeGetAllQuery, makeSingleQuery, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, wrapAllByQueryWithSuggestion, wrapSingleQueryWithSuggestion } from "../node_modules/.pnpm/@testing-library_dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.qwik.mjs";
|
|
4
4
|
import { qwikLoader } from "./qwikloader.qwik.mjs";
|
|
5
|
+
import { clearAllMocks, mock$, mockQrl } from "./mock.qwik.mjs";
|
|
5
6
|
const mountedContainers = /* @__PURE__ */ new Set();
|
|
6
7
|
async function render(ui, options = {}) {
|
|
7
8
|
const qwik = await import("@builder.io/qwik");
|
|
@@ -58,6 +59,7 @@ function cleanup() {
|
|
|
58
59
|
export {
|
|
59
60
|
buildQueries,
|
|
60
61
|
cleanup,
|
|
62
|
+
clearAllMocks,
|
|
61
63
|
configure,
|
|
62
64
|
createEvent,
|
|
63
65
|
findAllByAltText,
|
|
@@ -107,6 +109,8 @@ export {
|
|
|
107
109
|
makeFindQuery,
|
|
108
110
|
makeGetAllQuery,
|
|
109
111
|
makeSingleQuery,
|
|
112
|
+
mock$,
|
|
113
|
+
mockQrl,
|
|
110
114
|
prettyDOM,
|
|
111
115
|
queries,
|
|
112
116
|
queryAllByAltText,
|