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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xenopomp-essentials",
3
- "version": "0.5.0-canary.5",
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",
@@ -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, injectMatchMediaMock, injectMocks, mockEnv, mockRouter, spyFactory, stubGlobal, twApiMock };
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, injectMatchMediaMock, injectMocks, mockEnv, mockRouter, spyFactory, stubGlobal, twApiMock };
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 c,vi as t,afterEach as f,beforeAll as u,afterAll as h}from"vitest";import{render as d,renderHook as m}from"@testing-library/react";import l from"ansi-colors";import p from"vitest-matchmedia-mock";const a=e=>{c(()=>e()).not.toThrow()},b=(...e)=>{a(()=>d(...e))},C=(...e)=>{a(()=>m(...e))},k=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()},x=()=>{t.mock("next/navigation",()=>({useRouter:()=>({push(){}}),usePathname:()=>"/"}))},A={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 g{_executionContext;constructor(o){this._executionContext=o}call(...o){console.debug(`${l.blue(`[${this._executionContext}]`)} ${l.green(`Custom spy is called with these args: ${l.blueBright(o.map(n=>`${n}`).join(", "))}`)}`)}}function v(e){const o=new g(e),n=t.spyOn(o,"call");return{expectToBeCalled:(...s)=>c(n).toHaveBeenCalledWith(s),expectToBeNotCalled:(...s)=>c(n).not.toHaveBeenCalledWith(s),spy:n,callSpy:(...s)=>o.call(s)}}const E=(e,o)=>{t.stubGlobal(e,o)},M={beforeAll:u,afterEach:f},i=(e,o="beforeAll")=>{let n;M[o](()=>n=e()),h(()=>{r(),n?.()})},y=()=>{const e=new p;i(()=>(e.clear(),()=>e.destroy()),"afterEach")};export{C as assertHookRendering,a as assertNotThrowing,b as assertRendering,r as clearMocks,y as injectMatchMediaMock,i as injectMocks,k as mockEnv,x as mockRouter,v as spyFactory,E as stubGlobal,A as twApiMock};
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};