twd-js 0.1.2 → 0.2.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 +125 -53
- package/dist/cli.js +35 -0
- package/dist/commands/{mockResponses.d.ts → mockBridge.d.ts} +17 -3
- package/dist/mock-sw.js +1 -0
- package/dist/twd.d.ts +33 -2
- package/dist/twd.es.js +283 -269
- package/dist/twd.umd.js +5 -5
- package/dist/ui/TestListItem.d.ts +20 -0
- package/package.json +29 -4
package/dist/twd.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h,
|
|
1
|
+
(function(h,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(h=typeof globalThis<"u"?globalThis:h||self,v(h.TWD={},h.React))})(this,(function(h,v){"use strict";const te=(e,r=2e3,n=50)=>new Promise((s,i)=>{const c=Date.now(),l=()=>{const u=e();if(u)return s(u);if(Date.now()-c>r)return i(new Error("Timeout waiting for element"));setTimeout(l,n)};l()}),E=[];let N=[];const L=(e,r,n={})=>{E.push({name:e,fn:r,status:"idle",logs:[],suite:[...N],...n})},ne=e=>{N.push(e)},re=()=>{N.pop()},b=(e,r,n,s)=>{if(!e&&!r)throw new Error(s);if(e&&r)throw new Error(s.replace("to be","to not be").replace("to have","to not have").replace("to contain","to not contain"));return n};function se(e){if(!e.isConnected)return!1;let r=e;for(;r;){const n=getComputedStyle(r);if(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse")return!1;r=r.parentElement}return!0}const oe=(e,r,...n)=>{const s=r.startsWith("not."),i=s?r.slice(4):r,c=(e.textContent||"").trim();switch(i){case"have.text":return b(c===n[0],s,`Assertion passed: Text is exactly "${n[0]}"`,`Assertion failed: Expected text to be "${n[0]}", but got "${c}"`);case"contain.text":return b(c.includes(n[0]),s,`Assertion passed: Text contains "${n[0]}"`,`Assertion failed: Expected text to contain "${n[0]}", but got "${c}"`);case"be.empty":return b(c.length===0,s,"Assertion passed: Text is empty",`Assertion failed: Expected text to be empty, but got "${c}"`);case"have.attr":return b(e.getAttribute(n[0])===n[1],s,`Assertion passed: Attribute "${n[0]}" is "${n[1]}"`,`Assertion failed: Expected attribute "${n[0]}" to be "${n[1]}", but got "${e.getAttribute(n[0])}"`);case"have.value":return b(e.value===n[0],s,`Assertion passed: Value is "${n[0]}"`,`Assertion failed: Expected value to be "${n[0]}", but got "${e.value}"`);case"be.disabled":return b(e.disabled===!0,s,"Assertion passed: Element is disabled","Assertion failed: Expected element to be disabled");case"be.enabled":return b(e.disabled===!1,s,"Assertion passed: Element is enabled","Assertion failed: Expected element to be enabled");case"be.checked":return b(e.checked===!0,s,"Assertion passed: Element is checked","Assertion failed: Expected element to be checked");case"be.selected":return b(e.selected===!0,s,"Assertion passed: Element is selected","Assertion failed: Expected element to be selected");case"be.focused":return b(document.activeElement===e,s,"Assertion passed: Element is focused","Assertion failed: Expected element to be focused");case"be.visible":return b(se(e),s,"Assertion passed: Element is visible","Assertion failed: Expected element to be visible");case"have.class":return b(e.classList.contains(n[0]),s,`Assertion passed: Element has class "${n[0]}"`,`Assertion failed: Expected element to have class "${n[0]}"`);default:throw new Error(`Unknown assertion: ${i}`)}},R=e=>{const r=E.find(n=>n.status==="running");r&&r.logs?.push(e)},k=[],C={},F=100,ie=async()=>{"serviceWorker"in navigator&&(await navigator.serviceWorker.register("/mock-sw.js?v=1"),navigator.serviceWorker.addEventListener("message",e=>{if(e.data?.type==="EXECUTED"){const{alias:r,request:n}=e.data,s=k.find(i=>i.alias===r);s&&(s.executed=!0,s.request=n,C[r]&&(C[r](s),delete C[r]))}}))},q=e=>new Promise(r=>setTimeout(r,e)),ae=async(e,r)=>{const n={alias:e,...r,executed:!1},s=k.findIndex(i=>i.alias===e);s!==-1?k[s]=n:k.push(n),navigator.serviceWorker.controller?.postMessage({type:"ADD_RULE",rule:n}),await q(F),await Promise.resolve()},ce=async e=>{await q(F);const r=k.find(n=>n.alias===e&&n.executed);return r?Promise.resolve(r):new Promise(n=>{C[e]=n})},le=()=>k,ue=()=>{k.length=0},de=(e,r)=>{for(const n of r){const s=n.charCodeAt(0);e.dispatchEvent(new KeyboardEvent("keydown",{key:n,code:`Key${n.toUpperCase()}`,keyCode:s,which:s,bubbles:!0,cancelable:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:n,code:`Key${n.toUpperCase()}`,keyCode:s,which:s,bubbles:!0,cancelable:!0})),e.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value")?.set?.call(e,e.value+n),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:n,code:`Key${n.toUpperCase()}`,keyCode:s,which:s,bubbles:!0,cancelable:!0}))}return e},fe=(e,r)=>{const n=e.startsWith("not.");switch(n?e.slice(4):e){case"eq":return b(window.location.href===r,n,`Assertion passed: URL is ${r}`,`Assertion failed: Expected URL to be ${r}, but got ${window.location.href}`);case"contain.url":return b(window.location.href.includes(r),n,`Assertion passed: URL contains ${r}`,`Assertion failed: Expected URL to contain ${r}, but got ${window.location.href}`);default:throw new Error(`Unknown assertion: ${e}`)}},pe=()=>({location:window.location,should:fe});let j=null;const be=e=>{j=e},me=(e,r)=>{ne(e),r(),re()},he=(e,r)=>{L(e,async()=>{j&&await j(),await r()})},xe=(e,r)=>{L(e,async()=>{j&&await j(),await r()},{only:!0})},ge=(e,r)=>{L(e,async()=>{},{skip:!0})},we={get:async e=>{R(`Searching get("${e}")`);const r=await te(()=>document.querySelector(e)),n={el:r,click:()=>{R(`click(${e})`),r.click()},type:s=>(R(`type("${s}") into ${e}`),de(r,s)),should:(s,...i)=>{const c=oe(r,s,...i);return R(c),n},text:()=>{const s=r.textContent||"";return R(`text(${e}) → "${s}"`),s}};return n},visit:e=>{R(`visit("${e}")`),window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"))},url:pe,mockRequest:ae,waitForRequest:ce,initRequestMocking:ie,clearRequestMockRules:ue,getRequestMockRules:le};var O={exports:{}},S={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var z;function ve(){if(z)return S;z=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function n(s,i,c){var l=null;if(c!==void 0&&(l=""+c),i.key!==void 0&&(l=""+i.key),"key"in i){c={};for(var u in i)u!=="key"&&(c[u]=i[u])}else c=i;return i=c.ref,{$$typeof:e,type:s,key:l,ref:i!==void 0?i:null,props:c}}return S.Fragment=r,S.jsx=n,S.jsxs=n,S}var _={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var B;function ye(){return B||(B=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Be?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case W:return"Fragment";case De:return"Profiler";case We:return"StrictMode";case Me:return"Suspense";case Fe:return"SuspenseList";case ze:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Le:return"Portal";case Ye:return(t.displayName||"Context")+".Provider";case Ie:return(t._context.displayName||"Context")+".Consumer";case Ue:var o=t.render;return t=t.displayName,t||(t=o.displayName||o.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case qe:return o=t.displayName||null,o!==null?o:e(t.type)||"Memo";case G:o=t._payload,t=t._init;try{return e(t(o))}catch{}}return null}function r(t){return""+t}function n(t){try{r(t);var o=!1}catch{o=!0}if(o){o=console;var d=o.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),r(t)}}function s(t){if(t===W)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===G)return"<...>";try{var o=e(t);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function i(){var t=D.A;return t===null?null:t.getOwner()}function c(){return Error("react-stack-top-frame")}function l(t){if(X.call(t,"key")){var o=Object.getOwnPropertyDescriptor(t,"key").get;if(o&&o.isReactWarning)return!1}return t.key!==void 0}function u(t,o){function d(){H||(H=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}function m(){var t=e(this.type);return K[t]||(K[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function g(t,o,d,f,y,w,Y,U){return d=w.ref,t={$$typeof:J,type:t,key:o,props:w,_owner:y},(d!==void 0?d:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:m}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function x(t,o,d,f,y,w,Y,U){var p=o.children;if(p!==void 0)if(f)if(Ve(p)){for(f=0;f<p.length;f++)T(p[f]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(p);if(X.call(o,"key")){p=e(t);var A=Object.keys(o).filter(function(Je){return Je!=="key"});f=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",ee[p+f]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,f,p,
|
|
22
|
+
<%s key={someKey} {...props} />`,f,p,A,p),ee[p+f]=!0)}if(p=null,d!==void 0&&(n(d),p=""+d),l(o)&&(n(o.key),p=""+o.key),"key"in o){d={};for(var M in o)M!=="key"&&(d[M]=o[M])}else d=o;return p&&u(d,typeof t=="function"?t.displayName||t.name||"Unknown":t),g(t,p,w,y,i(),d,Y,U)}function T(t){typeof t=="object"&&t!==null&&t.$$typeof===J&&t._store&&(t._store.validated=1)}var $=v,J=Symbol.for("react.transitional.element"),Le=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),We=Symbol.for("react.strict_mode"),De=Symbol.for("react.profiler"),Ie=Symbol.for("react.consumer"),Ye=Symbol.for("react.context"),Ue=Symbol.for("react.forward_ref"),Me=Symbol.for("react.suspense"),Fe=Symbol.for("react.suspense_list"),qe=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),ze=Symbol.for("react.activity"),Be=Symbol.for("react.client.reference"),D=$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,Ve=Array.isArray,I=console.createTask?console.createTask:function(){return null};$={react_stack_bottom_frame:function(t){return t()}};var H,K={},Z=$.react_stack_bottom_frame.bind($,c)(),Q=I(s(c)),ee={};_.Fragment=W,_.jsx=function(t,o,d,f,y){var w=1e4>D.recentlyCreatedOwnerStacks++;return x(t,o,d,!1,f,y,w?Error("react-stack-top-frame"):Z,w?I(s(t)):Q)},_.jsxs=function(t,o,d,f,y){var w=1e4>D.recentlyCreatedOwnerStacks++;return x(t,o,d,!0,f,y,w?Error("react-stack-top-frame"):Z,w?I(s(t)):Q)}})()),_}var V;function Ee(){return V||(V=1,process.env.NODE_ENV==="production"?O.exports=ve():O.exports=ye()),O.exports}var a=Ee();const ke=e=>{const r={children:[]};for(const n of e){let s=r;n.suite.forEach(i=>{let c=s.children.find(l=>"name"in l&&!l.status&&l.name===i);c||(c={name:i,children:[]},s.children.push(c)),s=c}),s.children.push(n)}return r.children},Re={animation:"spin 1s linear infinite"},Te=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle-icon lucide-loader-circle",style:Re,"data-testid":"loader-icon",children:a.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),P=typeof document<"u"?document.createElement("style"):null;P&&!document.getElementById("loader-spin-keyframes")&&(P.id="loader-spin-keyframes",P.innerHTML=`
|
|
23
23
|
@keyframes spin {
|
|
24
24
|
0% { transform: rotate(0deg); }
|
|
25
25
|
100% { transform: rotate(360deg); }
|
|
26
26
|
}
|
|
27
|
-
`,document.head.appendChild(
|
|
27
|
+
`,document.head.appendChild(P));const Ae=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-play-icon lucide-play","data-testid":"play-icon",children:a.jsx("path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"})}),je=e=>{switch(e.status){case"pass":return{item:{background:"#dcfce7"},container:{borderLeft:"3px solid #00c951"}};case"fail":return{item:{background:"#fee2e2"},container:{borderLeft:"3px solid #fb2c36"}};case"skip":return{item:{background:"#f3f4f6"}};case"running":return{item:{background:"#fef9c3"}};default:return{item:{background:"transparent"}}}},Se=e=>e.startsWith("Assertion passed")?{color:"#0d542b",fontWeight:"700"}:e.startsWith("Test failed")?{color:"#fb2c36",fontWeight:"700"}:{},_e=({node:e,depth:r,idx:n,runTest:s})=>{const i=je(e);return a.jsxs("li",{style:{marginBottom:"4px",marginLeft:r*6,...i.container},"data-testid":`test-list-item-${n}`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"left",justifyContent:"space-between",padding:"4px 6px",borderRadius:"4px",...i.item},children:[a.jsxs("span",{style:{fontWeight:"500",color:"#374151",maxWidth:"220px"},children:[e.name," ",e.only&&a.jsx("span",{style:{color:"#2563eb"},"data-testid":`only-indicator-${n}`,children:" (only)"}),e.skip&&a.jsx("span",{style:{color:"#6b7280"},"data-testid":`skip-indicator-${n}`,children:" (skipped)"})]}),a.jsx("button",{onClick:()=>s(n),"aria-label":`Run ${e.name} test`,style:{background:"transparent",border:"1px solid #d1d5db",borderRadius:"4px",padding:"0",cursor:"pointer",verticalAlign:"middle",fontSize:"12px",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},disabled:e.status==="running","data-testid":`run-test-button-${n}`,children:e.status==="running"?a.jsx(Te,{}):a.jsx(Ae,{})})]}),e.logs&&e.logs.length>0&&a.jsx("ul",{style:{borderRadius:"4px",maxHeight:"260px",overflowY:"auto",padding:0,background:"#f3f4f6",listStyle:"none",marginTop:"4px",textAlign:"left"},children:e.logs.map((c,l)=>a.jsx("li",{style:{fontSize:"12px",padding:"4px 6px",borderBottom:"1px solid #d1d5db",...Se(c)},children:c},l))})]},e.name)},Ce=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-chevron-down-icon lucide-chevron-down","data-testid":"chevron-down-icon",children:a.jsx("path",{d:"m6 9 6 6 6-6"})}),Oe=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-chevron-right-icon lucide-chevron-right","data-testid":"chevron-right-icon",children:a.jsx("path",{d:"m9 18 6-6-6-6"})}),Pe=({runTest:e,tests:r})=>{const[n,s]=v.useState({}),i=(l,u=0)=>{if("status"in l)return a.jsx(_e,{node:l,depth:u,idx:r.indexOf(l),runTest:e},l.name);const m=n[l.name];return a.jsxs("li",{style:{marginBottom:"6px",marginLeft:u*12,textAlign:"left"},children:[a.jsxs("div",{style:{fontWeight:"bold",cursor:"pointer",color:"#374151",marginBottom:"4px",display:"flex",alignItems:"center",gap:"4px"},onClick:()=>s(g=>({...g,[l.name]:!g[l.name]})),"data-testid":`test-group-${l.name}`,tabIndex:0,role:"button","aria-expanded":!m,children:[l.name," ",m?a.jsx(Oe,{}):a.jsx(Ce,{})]}),!m&&a.jsx("ul",{style:{listStyle:"none",padding:0},children:l.children.map(g=>i(g,u+1))})]},l.name)},c=ke(r);return a.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:c.map(l=>i(l))})},$e=({setOpen:e})=>a.jsx("div",{style:{position:"fixed",top:"50%",left:0,transform:"translateY(-50%)",background:"#3b82f6",color:"white",padding:"6px 10px",borderTopRightRadius:"6px",borderBottomRightRadius:"6px",cursor:"pointer",fontSize:"12px"},onClick:()=>e(!0),children:"TWD"}),Ne=()=>{const[e,r]=v.useState(0),[n,s]=v.useState(!0),i=async l=>{const u=E[l];u.logs=[];const m=console.log,g=console.error;if(console.log=(...x)=>{u.logs?.push(x.map(String).join(" ")),m(...x),r(T=>T+1)},console.error=(...x)=>{u.logs?.push(x.map(String).join(" ")),g(...x),r(T=>T+1)},u.status="running",u.skip)u.status="skip";else try{await u.fn(),u.status="pass"}catch(x){u.status="fail",console.error("Test failed:",u.name,x)}console.log=m,console.error=g,r(x=>x+1)},c=async()=>{const l=E.filter(m=>m.only),u=l.length>0?l:E;for(let m=0;m<u.length;m++){const g=E.indexOf(u[m]);await i(g)}};return n?a.jsxs("div",{style:{position:"fixed",top:0,left:0,bottom:0,width:"280px",textAlign:"left",background:"#f9fafb",borderRight:"1px solid #e5e7eb",padding:"8px",fontSize:"14px",overflowY:"auto",boxShadow:"2px 0 6px rgba(0,0,0,0.1)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"14px",alignItems:"center"},children:[a.jsx("strong",{style:{fontSize:"18px",fontWeight:"bold",color:"#374151"},children:"TWD Tests"}),a.jsx("button",{style:{background:"transparent",border:"none",cursor:"pointer",fontSize:"14px"},onClick:()=>s(!1),children:"✖"})]}),a.jsx("button",{onClick:c,style:{background:"#3b82f6",color:"white",padding:"4px 8px",borderRadius:"4px",border:"none",marginBottom:"10px",cursor:"pointer"},children:"Run All"}),a.jsx(Pe,{tests:E,runTest:i})]}):a.jsx($e,{setOpen:s})};h.TWDSidebar=Ne,h.beforeEach=be,h.describe=me,h.it=he,h.itOnly=xe,h.itSkip=ge,h.twd=we,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -5,5 +5,25 @@ interface TestListItemProps {
|
|
|
5
5
|
idx: number;
|
|
6
6
|
runTest: (i: number) => void;
|
|
7
7
|
}
|
|
8
|
+
export declare const statusStyles: (node: TestCase) => {
|
|
9
|
+
item: {
|
|
10
|
+
background: string;
|
|
11
|
+
};
|
|
12
|
+
container: {
|
|
13
|
+
borderLeft: string;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
item: {
|
|
17
|
+
background: string;
|
|
18
|
+
};
|
|
19
|
+
container?: undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const assertStyles: (text: string) => {
|
|
22
|
+
color: string;
|
|
23
|
+
fontWeight: string;
|
|
24
|
+
} | {
|
|
25
|
+
color?: undefined;
|
|
26
|
+
fontWeight?: undefined;
|
|
27
|
+
};
|
|
8
28
|
export declare const TestListItem: ({ node, depth, idx, runTest }: TestListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twd-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Test While Developing (TWD) - in-browser testing",
|
|
5
5
|
"main": "./dist/twd.umd.js",
|
|
6
6
|
"module": "./dist/twd.es.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"twd-js": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git@github.com:BRIKEV/twd.git"
|
|
14
|
+
},
|
|
8
15
|
"exports": {
|
|
9
16
|
".": {
|
|
10
17
|
"types": "./dist/index.d.ts",
|
|
@@ -16,7 +23,7 @@
|
|
|
16
23
|
"dist"
|
|
17
24
|
],
|
|
18
25
|
"scripts": {
|
|
19
|
-
"build": "vite build",
|
|
26
|
+
"build": "vite build && vite build -c vite.sw.config.js && cp src/cli/installsw.js dist/cli.js",
|
|
20
27
|
"test": "vitest",
|
|
21
28
|
"test:ci": "vitest --run --coverage",
|
|
22
29
|
"conventional-changelog": "conventional-changelog -i CHANGELOG.md",
|
|
@@ -27,7 +34,11 @@
|
|
|
27
34
|
"react-dom": ">=17.0.0"
|
|
28
35
|
},
|
|
29
36
|
"devDependencies": {
|
|
30
|
-
"@
|
|
37
|
+
"@testing-library/dom": "^10.4.1",
|
|
38
|
+
"@testing-library/jest-dom": "^6.8.0",
|
|
39
|
+
"@testing-library/react": "^16.3.0",
|
|
40
|
+
"@testing-library/user-event": "^14.6.1",
|
|
41
|
+
"@types/react": "^19.1.13",
|
|
31
42
|
"@types/react-dom": "^19.1.9",
|
|
32
43
|
"@vitejs/plugin-react": "^5.0.2",
|
|
33
44
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -37,5 +48,19 @@
|
|
|
37
48
|
"vite": "^7.1.4",
|
|
38
49
|
"vite-plugin-dts": "^4.5.4",
|
|
39
50
|
"vitest": "^3.2.4"
|
|
40
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"testing",
|
|
54
|
+
"twd-js",
|
|
55
|
+
"twd",
|
|
56
|
+
"tdd",
|
|
57
|
+
"bdd",
|
|
58
|
+
"test",
|
|
59
|
+
"development",
|
|
60
|
+
"react",
|
|
61
|
+
"javascript",
|
|
62
|
+
"typescript",
|
|
63
|
+
"vite",
|
|
64
|
+
"vitest"
|
|
65
|
+
]
|
|
41
66
|
}
|