@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 +0 -14
- package/dist/index.js +9 -6
- package/dist/runner.js +1 -1
- package/dist/setup.js +35 -35
- package/package.json +2 -2
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
|
-
|
|
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
|
-
|
|
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
|
|
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}))}};
|