@testspectra/react 1.1.8-rc.28 → 1.1.8-rc.29

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/dist/index.d.ts CHANGED
@@ -38,17 +38,3 @@ export declare function sanitizeErrorMessage(msg: string): string;
38
38
  export declare function sanitizeViteUrl(text: string): string;
39
39
  export declare function sanitizeStackTrace(stack: string): string;
40
40
  export declare function isVitestNoise(line: string): boolean;
41
-
42
- export interface AssertionMatchers<T = unknown> {
43
- toBe(expected: T): void;
44
- toEqual(expected: unknown): void;
45
- toBeTruthy(): void;
46
- toBeFalsy(): void;
47
- toBeNull(): void;
48
- toBeUndefined(): void;
49
- toBeDefined(): void;
50
- toContain(item: unknown): void;
51
- not: AssertionMatchers<T>;
52
- }
53
-
54
- export type ExpectStatic = <T = unknown>(actual: T) => AssertionMatchers<T>;
package/dist/index.js CHANGED
@@ -1,16 +1,19 @@
1
1
  // src/dom_driver_bridge.ts
2
2
  import { userEvent } from "@testing-library/user-event";
3
- var cachedUser = null;
4
3
  function getUser() {
5
- if (!cachedUser) {
6
- cachedUser = userEvent.setup({ delay: null });
7
- }
8
- return cachedUser;
4
+ return userEvent.setup({ delay: null });
9
5
  }
10
6
  function resolveSelector(selector) {
11
7
  const trimmed = selector.trim();
12
8
  if (trimmed.startsWith("~")) {
13
- return `[aria-label=${JSON.stringify(trimmed.slice(1))}]`;
9
+ const raw = trimmed.slice(1);
10
+ const bracketIndex = raw.indexOf("[");
11
+ if (bracketIndex !== -1) {
12
+ const label = raw.slice(0, bracketIndex);
13
+ const rest = raw.slice(bracketIndex);
14
+ return `[aria-label=${JSON.stringify(label)}]${rest}`;
15
+ }
16
+ return `[aria-label=${JSON.stringify(raw)}]`;
14
17
  }
15
18
  return trimmed;
16
19
  }
package/dist/runner.js CHANGED
@@ -1 +1 @@
1
- var T=[],a=[],d=[];globalThis.it=function(n,e){T.push({title:n,fn:e})};globalThis.beforeEach=function(n){a.push(n)};globalThis.afterEach=function(n){d.push(n)};function y(n){let e=t=>({toBe(o){let r=Object.is(n,o);if(t?r:!r)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be":"to be"} ${JSON.stringify(o)}`)},toEqual(o){let r=JSON.stringify(n)===JSON.stringify(o);if(t?r:!r)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to equal":"to equal"} ${JSON.stringify(o)}`)},toBeTruthy(){let o=!!n;if(t?o:!o)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be truthy":"to be truthy"}`)},toBeFalsy(){let o=!n;if(t?o:!o)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be falsy":"to be falsy"}`)},toBeNull(){let o=n===null;if(t?o:!o)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be null":"to be null"}`)},toBeUndefined(){let o=n===void 0;if(t?o:!o)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be undefined":"to be undefined"}`)},toBeDefined(){let o=n!==void 0;if(t?o:!o)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to be defined":"to be defined"}`)},toContain(o){let r=Array.isArray(n)?n.includes(o):typeof n=="string"?n.includes(String(o)):!1;if(t?r:!r)throw new Error(`Expected ${JSON.stringify(n)} ${t?"not to contain":"to contain"} ${JSON.stringify(o)}`)}});return{...e(!1),not:e(!0)}}globalThis.expect=y;function w(){let n=globalThis.Spectra;if(typeof n?.unmount=="function")n.unmount();else{let e=document.getElementById("spectra-root");e&&(e.innerHTML="")}}function s(n,e){console.log(`[${n}] ${e}`)}globalThis.__SPECTRA_RUNNER__={async run(n,e){s("TESTSPECTRA_SUITE_START",JSON.stringify({file:n}));let t=globalThis.__bootstrapAutoImports;if(typeof t=="function")try{await t(e)}catch(i){s("TESTSPECTRA_SUITE_ERROR",JSON.stringify({file:n,error:`Failed to bootstrap auto imports: ${String(i)}`}));return}let o=encodeURIComponent(n);try{await import(`/test?file=${o}`)}catch(i){s("TESTSPECTRA_SUITE_ERROR",JSON.stringify({file:n,error:String(i)}));return}let r=0,E=0;for(let{title:i,fn:u}of T){s("TESTSPECTRA_TEST_START",i),globalThis.__CURRENT_TEST_TITLE__=i;let S={task:{name:i}},g=performance.now();try{for(let c of a)await c(S);await u();for(let c of d)await c(S);let f=Math.round(performance.now()-g);s("TESTSPECTRA_TEST_PASS",`${i} (${f}ms)`),r++}catch(f){let c=Math.round(performance.now()-g),p=f instanceof Error?f.message:String(f);s("TESTSPECTRA_TEST_ERROR",p),s("TESTSPECTRA_TEST_FAIL",`${i} (${c}ms)`),E++}finally{w()}}T.length=0,a.length=0,d.length=0,s("TESTSPECTRA_SUITE_END",JSON.stringify({file:n,passed:r,failed:E}))}};
1
+ var i=[],a=[],T=[];globalThis.it=function(n,t){i.push({title:n,fn:t})};globalThis.beforeEach=function(n){a.push(n)};globalThis.afterEach=function(n){T.push(n)};function _(){let n=globalThis.Spectra;if(typeof n?.unmount=="function")n.unmount();else{let t=document.getElementById("spectra-root");t&&(t.innerHTML="")}}function r(n,t){console.log(`[${n}] ${t}`)}globalThis.__SPECTRA_RUNNER__={async run(n,t){r("TESTSPECTRA_SUITE_START",JSON.stringify({file:n}));let c=globalThis.__bootstrapAutoImports;if(typeof c=="function")try{await c(t)}catch(o){r("TESTSPECTRA_SUITE_ERROR",JSON.stringify({file:n,error:`Failed to bootstrap auto imports: ${String(o)}`}));return}let l=encodeURIComponent(n);try{await import(`/test?file=${l}`)}catch(o){r("TESTSPECTRA_SUITE_ERROR",JSON.stringify({file:n,error:String(o)}));return}let f=0,S=0;for(let{title:o,fn:g}of i){r("TESTSPECTRA_TEST_START",o),globalThis.__CURRENT_TEST_TITLE__=o;let E={task:{name:o}},u=performance.now();try{for(let e of a)await e(E);await g();for(let e of T)await e(E);let s=Math.round(performance.now()-u);r("TESTSPECTRA_TEST_PASS",`${o} (${s}ms)`),f++}catch(s){let e=Math.round(performance.now()-u),R=s instanceof Error?s.message:String(s);r("TESTSPECTRA_TEST_ERROR",R),r("TESTSPECTRA_TEST_FAIL",`${o} (${e}ms)`),S++}finally{_()}}i.length=0,a.length=0,T.length=0,r("TESTSPECTRA_SUITE_END",JSON.stringify({file:n,passed:f,failed:S}))}};