xenopomp-essentials 0.5.0-canary.5 → 0.5.0-canary.7
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/package.json +2 -1
- package/vitest/index.d.mts +1 -22
- package/vitest/index.d.ts +1 -22
- package/vitest/index.mjs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xenopomp-essentials",
|
|
3
|
-
"version": "0.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.7",
|
|
4
4
|
"author": "XenoPOMP <101574433+XenoPOMP@users.noreply.github.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"pinst": "^3.0.0",
|
|
94
94
|
"prettier": "^3.4.2",
|
|
95
95
|
"react-dom": "^19.2.0",
|
|
96
|
+
"rimraf": "^6.1.2",
|
|
96
97
|
"tsd": "^0.31.2",
|
|
97
98
|
"unbuild": "^3.6.1",
|
|
98
99
|
"vite": "^7.2.4",
|
package/vitest/index.d.mts
CHANGED
|
@@ -138,27 +138,6 @@ declare const strategies: {
|
|
|
138
138
|
*/
|
|
139
139
|
declare const injectMocks: (func: () => AfterAllCallback, strategy?: Strategy) => void;
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
* Mocks stuff related to window.matchMedia.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* describe('Root layout test', () => {
|
|
146
|
-
* // Use it inside describe suite. Place it to top
|
|
147
|
-
* injectMatchMediaMock();
|
|
148
|
-
*
|
|
149
|
-
* injectMocks(() => {
|
|
150
|
-
* vi.mock('next/font/google', () => ({
|
|
151
|
-
* Inter: FONT_MOCK,
|
|
152
|
-
* }));
|
|
153
|
-
* });
|
|
154
|
-
*
|
|
155
|
-
* testNextPage(<RootLayout children={undefined} />, {
|
|
156
|
-
* generateMetadata,
|
|
157
|
-
* });
|
|
158
|
-
* });
|
|
159
|
-
*/
|
|
160
|
-
declare const injectMatchMediaMock: () => void;
|
|
161
|
-
|
|
162
141
|
/**
|
|
163
142
|
* Recursevely changes all keys` types inside T to R.
|
|
164
143
|
*/
|
|
@@ -172,5 +151,5 @@ type StubValue = Mock | (() => Mock) | (() => Promise<Mock>);
|
|
|
172
151
|
*/
|
|
173
152
|
type Stub<T extends object> = TypeReplaceDeep<T, StubValue>;
|
|
174
153
|
|
|
175
|
-
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks,
|
|
154
|
+
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks, injectMocks, mockEnv, mockRouter, spyFactory, stubGlobal, twApiMock };
|
|
176
155
|
export type { Stub, TypeReplaceDeep };
|
package/vitest/index.d.ts
CHANGED
|
@@ -138,27 +138,6 @@ declare const strategies: {
|
|
|
138
138
|
*/
|
|
139
139
|
declare const injectMocks: (func: () => AfterAllCallback, strategy?: Strategy) => void;
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
* Mocks stuff related to window.matchMedia.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* describe('Root layout test', () => {
|
|
146
|
-
* // Use it inside describe suite. Place it to top
|
|
147
|
-
* injectMatchMediaMock();
|
|
148
|
-
*
|
|
149
|
-
* injectMocks(() => {
|
|
150
|
-
* vi.mock('next/font/google', () => ({
|
|
151
|
-
* Inter: FONT_MOCK,
|
|
152
|
-
* }));
|
|
153
|
-
* });
|
|
154
|
-
*
|
|
155
|
-
* testNextPage(<RootLayout children={undefined} />, {
|
|
156
|
-
* generateMetadata,
|
|
157
|
-
* });
|
|
158
|
-
* });
|
|
159
|
-
*/
|
|
160
|
-
declare const injectMatchMediaMock: () => void;
|
|
161
|
-
|
|
162
141
|
/**
|
|
163
142
|
* Recursevely changes all keys` types inside T to R.
|
|
164
143
|
*/
|
|
@@ -172,5 +151,5 @@ type StubValue = Mock | (() => Mock) | (() => Promise<Mock>);
|
|
|
172
151
|
*/
|
|
173
152
|
type Stub<T extends object> = TypeReplaceDeep<T, StubValue>;
|
|
174
153
|
|
|
175
|
-
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks,
|
|
154
|
+
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks, injectMocks, mockEnv, mockRouter, spyFactory, stubGlobal, twApiMock };
|
|
176
155
|
export type { Stub, TypeReplaceDeep };
|
package/vitest/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expect as
|
|
1
|
+
import{expect as l,vi as t,afterEach as i,beforeAll as u,afterAll as f}from"vitest";import{render as h,renderHook as p}from"@testing-library/react";import c from"ansi-colors";const a=e=>{l(()=>e()).not.toThrow()},d=(...e)=>{a(()=>h(...e))},m=(...e)=>{a(()=>p(...e))},b=e=>{t.stubEnv("CANONICAL_URL","http://localhost:4242"),t.stubEnv("IS_PRODUCTION","false"),e&&Object.entries(e).forEach(([o,n])=>t.stubEnv(o,n))},r=()=>{t.clearAllMocks(),t.resetAllMocks(),t.unstubAllEnvs(),t.unstubAllGlobals()},C=()=>{t.mock("next/navigation",()=>({useRouter:()=>({push(){}}),usePathname:()=>"/"}))},x={addBase:t.fn(),addComponents:t.fn(),addUtilities:t.fn(),addVariant:t.fn(),config:t.fn(),corePlugins:t.fn(),e:t.fn(),matchComponents:t.fn(),matchUtilities:t.fn(),matchVariant:t.fn(),theme:t.fn()};class A{_executionContext;constructor(o){this._executionContext=o}call(...o){console.debug(`${c.blue(`[${this._executionContext}]`)} ${c.green(`Custom spy is called with these args: ${c.blueBright(o.map(n=>`${n}`).join(", "))}`)}`)}}function g(e){const o=new A(e),n=t.spyOn(o,"call");return{expectToBeCalled:(...s)=>l(n).toHaveBeenCalledWith(s),expectToBeNotCalled:(...s)=>l(n).not.toHaveBeenCalledWith(s),spy:n,callSpy:(...s)=>o.call(s)}}const k=(e,o)=>{t.stubGlobal(e,o)},v={beforeAll:u,afterEach:i},E=(e,o="beforeAll")=>{let n;v[o](()=>n=e()),f(()=>{r(),n?.()})};export{m as assertHookRendering,a as assertNotThrowing,d as assertRendering,r as clearMocks,E as injectMocks,b as mockEnv,C as mockRouter,g as spyFactory,k as stubGlobal,x as twApiMock};
|