Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

feat: set up vitest testing infrastructure with WXT integration

Luis Ortiz2eeaaf50139e
diff --git a/package.json b/package.json
index b2d7f07..f6c52eb 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,9 @@
"dev": "wxt",
"build": "wxt build",
"zip": "wxt zip",
- "test": "echo \"Error: no test specified\" && exit 1",
+ "test": "vitest run",
+ "test:watch": "vitest",
+ "test:cov": "vitest run --coverage",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"format": "biome format --write .",
@@ -49,6 +51,7 @@
"@testing-library/react": "^16.3.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
+ "@vitest/coverage-istanbul": "^4.1.3",
"@wxt-dev/i18n": "^0.2.5",
"fake-indexeddb": "^6.2.5",
"happy-dom": "^20.8.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0c88390..cda9b6d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -99,6 +99,9 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/[email protected])
+ '@vitest/coverage-istanbul':
+ specifier: ^4.1.3
'@wxt-dev/i18n':
specifier: ^0.2.5
@@ -182,6 +185,36 @@ packages:
resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
engines: {node: '>=6.9.0'}
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0
+
resolution: {integrity: sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==}
engines: {node: '>=6.9.0'}
@@ -190,6 +223,14 @@ packages:
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
engines: {node: '>=6.9.0'}
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==}
+ engines: {node: '>=6.9.0'}
+
resolution: {integrity: sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==}
engines: {node: '>=6.0.0'}
@@ -203,6 +244,14 @@ packages:
resolution: {integrity: sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==}
engines: {node: '>=6.9.0'}
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==}
+ engines: {node: '>=6.9.0'}
+
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'}
@@ -509,6 +558,10 @@ packages:
'@fontsource/[email protected]':
resolution: {integrity: sha512-6uQyPmseo4FgI97WIhA4yWRlNaoLk4vSDK/PyRwdqqZb5zAEuc+Kunt8JTMcsHYUEGYBtN15SNkMajMdqUSUmg==}
+ '@istanbuljs/[email protected]':
+ resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==}
+ engines: {node: '>=8'}
+
'@jridgewell/[email protected]':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
@@ -1544,6 +1597,11 @@ packages:
babel-plugin-react-compiler:
optional: true
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-IjlvIg2MaFDgeYOXgqxWwTh8c8Y8HkR/36SN0Iq5XtmsmbEau7a5i7g1F+Lv7G9R+vDzOt+HyNOmKqg/8kKzug==}
+ peerDependencies:
+ vitest: 4.1.3
+
'@vitest/[email protected]':
resolution: {integrity: sha512-gbu+7B0YgUJ2nkdsRJrFFW6X7NTP44WlhiclHniUhxADQJH5Szt9mZ9hWnJPJ8YwOK5zUOSSlSvyzRf0u1DSBQ==}
@@ -1703,6 +1761,11 @@ packages:
resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
engines: {node: '>= 0.6.0'}
+ resolution: {integrity: sha512-Lyf3aK28zpsD1yQMiiHD4RvVb6UdMoo8xzG2XzFIfR9luPzOpcBlAsT/qfB1XWS1bxWT+UtE4WmQgsp297FYOA==}
+ engines: {node: '>=6.0.0'}
+ hasBin: true
+
resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}
@@ -1727,6 +1790,11 @@ packages:
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==}
+ engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
+ hasBin: true
+
resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}
@@ -1757,6 +1825,9 @@ packages:
resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
engines: {node: '>=16'}
+ resolution: {integrity: sha512-4oxTZEvqmLLrERwxO76yfKM7acZo310U+v4kqexI2TL1DkkUEMT8UijrxxcnVdxR3qkVf5awGRX+4Z6aPHVKrA==}
+
resolution: {integrity: sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==}
engines: {node: '>=10.0.0'}
@@ -1997,6 +2068,9 @@ packages:
resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==}
+ resolution: {integrity: sha512-7OOtytmh/rINMLwaFTbcMVvYXO3AUm029X0LcyfYk0B557RlPkdpTpnH9+htMlfu5dKwOmT0+Zs2Aw+lnn6TeQ==}
+
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
@@ -2134,6 +2208,10 @@ packages:
resolution: {integrity: sha512-rci1g6U0rdTg6bAaBboP7XdRu01dzTAaKXxFf+PUqGuCv6Xu7o8NZdY1D5MvKGIjb6EdS1g3VlXOgksir1uGkg==}
hasBin: true
+ resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
+ engines: {node: '>=6.9.0'}
+
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
@@ -2184,6 +2262,10 @@ packages:
resolution: {integrity: sha512-Tz23LR9T9jOGVZm2x1EPdXqwA37G/owYMxRwU0E4miurAtFsPMQ1d2Jc2okUaSjZqAFz2oEn3FLXC5a0a+siyA==}
engines: {node: '>=20.0.0'}
+ resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-ZoKZSJgu8voGK2geJS+6YtYjvIzu9AOM/KZXsBxr83uhLL++e9pEv/dlgwgy3dvHg06kTz6JOh1hk3C8Ceiymw==}
@@ -2191,6 +2273,9 @@ packages:
resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
+ resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
+
resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
@@ -2332,6 +2417,18 @@ packages:
resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==}
hasBin: true
@@ -2351,6 +2448,11 @@ packages:
canvas:
optional: true
+ resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}
+ engines: {node: '>=6'}
+ hasBin: true
+
resolution: {integrity: sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
@@ -2531,6 +2633,9 @@ packages:
resolution: {integrity: sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA==}
engines: {node: 20 || >=22}
+ resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+
resolution: {integrity: sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A==}
peerDependencies:
@@ -2546,6 +2651,10 @@ packages:
resolution: {integrity: sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==}
+ resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
@@ -2616,6 +2725,9 @@ packages:
resolution: {integrity: sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ==}
+ resolution: {integrity: sha512-1h5gKZCF+pO/o3Iqt5Jp7wc9rH3eJJ0+nh/CIoiRwjRxde/hAHyLPXYN4V3CqKAbiZPSeJFSWHmJsbkicta0Eg==}
+
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
@@ -2936,6 +3048,10 @@ packages:
resolution: {integrity: sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==}
+ resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
+ hasBin: true
+
resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==}
engines: {node: '>=10'}
@@ -3062,6 +3178,10 @@ packages:
resolution: {integrity: sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg==}
+ resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==}
engines: {node: '>=12.0.0'}
@@ -3182,6 +3302,12 @@ packages:
resolution: {integrity: sha512-0Mqk3AT2TZCXWKdcoaufeXNukv2mTrEZExeXlHIOZXdqYoHHr4n51pymnwV8x2BOVxwXbK2HLlI7usrqMpycdg==}
engines: {node: ^20.19.0 || >=22.12.0}
+ resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==}
+ hasBin: true
+ peerDependencies:
+ browserslist: '>= 4.21.0'
+
resolution: {integrity: sha512-+dwUY4L35XFYEzE+OAL3sarJdUioVovq+8f7lcIJ7wnmnYQV5UD1Y/lcwaMSyaQ6Bj3JMj1XSTjZbNLHn/19yA==}
engines: {node: '>=18'}
@@ -3437,6 +3563,9 @@ packages:
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
+
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
@@ -3539,10 +3668,73 @@ snapshots:
js-tokens: 4.0.0
picocolors: 1.1.1
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/generator': 7.29.1
+ '@babel/helper-compilation-targets': 7.28.6
+ '@babel/helper-module-transforms': 7.28.6(@babel/[email protected])
+ '@babel/helpers': 7.29.2
+ '@babel/parser': 7.29.2
+ '@babel/template': 7.28.6
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
+ '@jridgewell/remapping': 2.3.5
+ convert-source-map: 2.0.0
+ debug: 4.4.3
+ gensync: 1.0.0-beta.2
+ json5: 2.2.3
+ semver: 6.3.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+ '@jridgewell/gen-mapping': 0.3.13
+ '@jridgewell/trace-mapping': 0.3.31
+ jsesc: 3.1.0
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/compat-data': 7.29.0
+ '@babel/helper-validator-option': 7.27.1
+ browserslist: 4.28.2
+ lru-cache: 5.1.1
+ semver: 6.3.1
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-module-imports': 7.28.6
+ '@babel/helper-validator-identifier': 7.28.5
+ '@babel/traverse': 7.29.0
+ transitivePeerDependencies:
+ - supports-color
+
'@babel/[email protected]': {}
'@babel/[email protected]': {}
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/template': 7.28.6
+ '@babel/types': 7.29.0
+
dependencies:
'@babel/types': 7.29.0
@@ -3551,6 +3743,24 @@ snapshots:
'@babel/[email protected]': {}
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/generator': 7.29.1
+ '@babel/helper-globals': 7.28.0
+ '@babel/parser': 7.29.2
+ '@babel/template': 7.28.6
+ '@babel/types': 7.29.0
+ debug: 4.4.3
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
'@babel/helper-string-parser': 7.27.1
@@ -3750,6 +3960,8 @@ snapshots:
'@fontsource/[email protected]': {}
+ '@istanbuljs/[email protected]': {}
+
'@jridgewell/[email protected]':
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
@@ -4763,6 +4975,22 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-rc.7
+ dependencies:
+ '@babel/core': 7.29.0
+ '@istanbuljs/schema': 0.1.3
+ '@jridgewell/gen-mapping': 0.3.13
+ '@jridgewell/trace-mapping': 0.3.31
+ istanbul-lib-coverage: 3.2.2
+ istanbul-lib-report: 3.0.1
+ istanbul-reports: 3.2.0
+ magicast: 0.5.2
+ obug: 2.1.1
+ tinyrainbow: 3.1.0
+ transitivePeerDependencies:
+ - supports-color
+
'@vitest/[email protected]':
dependencies:
'@standard-schema/spec': 1.1.0
@@ -4927,6 +5155,8 @@ snapshots:
optional: true
+
dependencies:
require-from-string: 2.0.2
@@ -4959,6 +5189,14 @@ snapshots:
dependencies:
fill-range: 7.1.1
+ dependencies:
+ baseline-browser-mapping: 2.10.16
+ caniuse-lite: 1.0.30001786
+ electron-to-chromium: 1.5.332
+ node-releases: 2.0.37
+ update-browserslist-db: 1.2.3([email protected])
+
@@ -4990,6 +5228,8 @@ snapshots:
+
dependencies:
'@babel/runtime': 7.29.2
@@ -5213,6 +5453,8 @@ snapshots:
dependencies:
safe-buffer: 5.2.1
+
@@ -5351,6 +5593,8 @@ snapshots:
which: 1.2.4
winreg: 0.0.12
+
@@ -5400,6 +5644,8 @@ snapshots:
- bufferutil
- utf-8-validate
+
@@ -5408,6 +5654,8 @@ snapshots:
transitivePeerDependencies:
- '@noble/hashes'
+
@@ -5508,6 +5756,19 @@ snapshots:
+
+ dependencies:
+ istanbul-lib-coverage: 3.2.2
+ make-dir: 4.0.0
+ supports-color: 7.2.0
+
+ dependencies:
+ html-escaper: 2.0.2
+ istanbul-lib-report: 3.0.1
+
@@ -5540,6 +5801,8 @@ snapshots:
transitivePeerDependencies:
- '@noble/hashes'
+
@@ -5716,6 +5979,10 @@ snapshots:
+ dependencies:
+ yallist: 3.1.1
+
dependencies:
react: 19.2.4
@@ -5732,6 +5999,10 @@ snapshots:
'@babel/types': 7.29.0
source-map-js: 1.2.1
+ dependencies:
+ semver: 7.7.4
+
@@ -5798,6 +6069,8 @@ snapshots:
uuid: 8.3.2
which: 2.0.2
+
@@ -6192,6 +6465,8 @@ snapshots:
+
@@ -6307,6 +6582,10 @@ snapshots:
+ dependencies:
+ has-flag: 4.0.0
+
optional: true
@@ -6414,6 +6693,12 @@ snapshots:
picomatch: 4.0.4
webpack-virtual-modules: 0.6.2
+ dependencies:
+ browserslist: 4.28.2
+ escalade: 3.2.0
+ picocolors: 1.1.1
+
dependencies:
boxen: 8.0.1
@@ -6705,6 +6990,8 @@ snapshots:
+
diff --git a/src/core/capture/__tests__/step-description.test.ts b/src/core/capture/__tests__/step-description.test.ts
new file mode 100644
index 0000000..44a1df7
--- /dev/null
+++ b/src/core/capture/__tests__/step-description.test.ts
@@ -0,0 +1,110 @@
+import { describe, expect, it } from 'vitest';
+import type { ElementMeta } from '@/core/guides/types';
+import { buildFallbackDescription } from '../step-description';
+
+function makeMeta(overrides: Partial<ElementMeta> = {}): ElementMeta {
+ return {
+ tag: 'button',
+ textContent: null,
+ ariaLabel: null,
+ placeholder: null,
+ altText: null,
+ name: null,
+ role: null,
+ href: null,
+ inputType: null,
+ selector: 'button.submit',
+ rect: null,
+ devicePixelRatio: 1,
+ ...overrides,
+ };
+}
+
+describe('buildFallbackDescription', () => {
+ it('generates click description using textContent', () => {
+ const result = buildFallbackDescription('click', makeMeta({ textContent: 'Submit' }));
+ expect(result).toBe('steps.click[Submit]');
+ });
+
+ it('generates click link description when href is present', () => {
+ const result = buildFallbackDescription('click', makeMeta({ textContent: 'Home', href: '/home' }));
+ expect(result).toBe('steps.clickLink[Home]');
+ });
+
+ it('generates checkbox toggle for input[type=checkbox]', () => {
+ const result = buildFallbackDescription(
+ 'click',
+ makeMeta({ tag: 'input', inputType: 'checkbox', ariaLabel: 'Accept terms' }),
+ );
+ expect(result).toBe('steps.toggleCheckbox[Accept terms]');
+ });
+
+ it('generates radio select for input[type=radio]', () => {
+ const result = buildFallbackDescription(
+ 'click',
+ makeMeta({ tag: 'input', inputType: 'radio', ariaLabel: 'Option A' }),
+ );
+ expect(result).toBe('steps.selectRadio[Option A]');
+ });
+
+ it('generates switch toggle for role=switch', () => {
+ const result = buildFallbackDescription('click', makeMeta({ role: 'switch', ariaLabel: 'Dark mode' }));
+ expect(result).toBe('steps.toggleSwitch[Dark mode]');
+ });
+
+ it('generates type description with input type', () => {
+ const result = buildFallbackDescription('input', makeMeta({ inputType: 'email', placeholder: 'Email' }));
+ expect(result).toBe('steps.typeIntoField[email,Email]');
+ });
+
+ it('generates generic type description without input type', () => {
+ const result = buildFallbackDescription('input', makeMeta({ ariaLabel: 'Search' }));
+ expect(result).toBe('steps.typeInto[Search]');
+ });
+
+ it('generates navigate description', () => {
+ const result = buildFallbackDescription('navigate', makeMeta());
+ expect(result).toBe('steps.navigate');
+ });
+
+ it('generates keydown description', () => {
+ const result = buildFallbackDescription('keydown:Enter', makeMeta({ ariaLabel: 'Search field' }));
+ expect(result).toBe('steps.pressKey[Enter,Search field]');
+ });
+
+ it('generates copy description', () => {
+ const result = buildFallbackDescription('copy', makeMeta({ ariaLabel: 'Code block' }));
+ expect(result).toBe('steps.copyFrom[Code block]');
+ });
+
+ it('generates paste description', () => {
+ const result = buildFallbackDescription('paste', makeMeta({ ariaLabel: 'Input field' }));
+ expect(result).toBe('steps.pasteInto[Input field]');
+ });
+
+ it('generates drag description', () => {
+ const result = buildFallbackDescription('drag', makeMeta({ ariaLabel: 'Card' }));
+ expect(result).toBe('steps.drag[Card]');
+ });
+
+ it('falls back to tag when no label is available', () => {
+ const result = buildFallbackDescription('click', makeMeta({ tag: 'div' }));
+ expect(result).toBe('steps.click[div]');
+ });
+
+ it('uses default action for unknown actions', () => {
+ const result = buildFallbackDescription('focus', makeMeta({ ariaLabel: 'Menu' }));
+ expect(result).toBe('steps.defaultAction[focus,Menu]');
+ });
+
+ it('prefers ariaLabel over textContent', () => {
+ const result = buildFallbackDescription('click', makeMeta({ ariaLabel: 'Close dialog', textContent: 'X' }));
+ expect(result).toBe('steps.click[Close dialog]');
+ });
+
+ it('truncates long textContent to 80 chars', () => {
+ const longText = 'A'.repeat(100);
+ const result = buildFallbackDescription('click', makeMeta({ textContent: longText }));
+ expect(result).toBe(`steps.click[${'A'.repeat(80)}]`);
+ });
+});
diff --git a/src/core/capture/ai/__tests__/prompts.test.ts b/src/core/capture/ai/__tests__/prompts.test.ts
new file mode 100644
index 0000000..4177498
--- /dev/null
+++ b/src/core/capture/ai/__tests__/prompts.test.ts
@@ -0,0 +1,51 @@
+import { describe, expect, it } from 'vitest';
+import { AI_LANGUAGES, getLanguageSuffix } from '../prompts';
+
+describe('getLanguageSuffix', () => {
+ it('returns empty string for English', () => {
+ expect(getLanguageSuffix('en')).toBe('');
+ });
+
+ it('returns empty string for en-US', () => {
+ expect(getLanguageSuffix('en-US')).toBe('');
+ });
+
+ it('returns Spanish suffix for es', () => {
+ expect(getLanguageSuffix('es')).toContain('Spanish');
+ });
+
+ it('returns French suffix for fr', () => {
+ expect(getLanguageSuffix('fr')).toContain('French');
+ });
+
+ it('returns Brazilian Portuguese suffix for pt-BR', () => {
+ expect(getLanguageSuffix('pt-BR')).toContain('Brazilian Portuguese');
+ });
+
+ it('returns the locale code for unknown languages', () => {
+ expect(getLanguageSuffix('sv')).toContain('sv');
+ });
+
+ it('includes IMPORTANT instruction', () => {
+ const suffix = getLanguageSuffix('es');
+ expect(suffix).toContain('IMPORTANT');
+ expect(suffix).toContain('Write the description in');
+ });
+});
+
+describe('AI_LANGUAGES', () => {
+ it('has 4 supported languages', () => {
+ expect(AI_LANGUAGES).toHaveLength(4);
+ });
+
+ it('includes English as first entry', () => {
+ expect(AI_LANGUAGES[0]).toEqual({ code: 'en', label: 'English' });
+ });
+
+ it('each entry has code and label', () => {
+ for (const lang of AI_LANGUAGES) {
+ expect(lang.code).toBeTruthy();
+ expect(lang.label).toBeTruthy();
+ }
+ });
+});
diff --git a/src/lib/__tests__/utils.test.ts b/src/lib/__tests__/utils.test.ts
new file mode 100644
index 0000000..20cab43
--- /dev/null
+++ b/src/lib/__tests__/utils.test.ts
@@ -0,0 +1,67 @@
+import { describe, expect, it } from 'vitest';
+import { extractDomain, getDomainInitial, getMostCommonDomain } from '../utils';
+
+describe('extractDomain', () => {
+ it('extracts hostname from a full URL', () => {
+ expect(extractDomain('https://github.com/westpoint-io/mimik')).toBe('github.com');
+ });
+
+ it('strips www prefix', () => {
+ expect(extractDomain('https://www.example.com/page')).toBe('example.com');
+ });
+
+ it('returns empty string for invalid URL', () => {
+ expect(extractDomain('not-a-url')).toBe('');
+ });
+
+ it('returns empty string for empty input', () => {
+ expect(extractDomain('')).toBe('');
+ });
+
+ it('handles URLs with ports', () => {
+ expect(extractDomain('http://localhost:3000/dashboard')).toBe('localhost');
+ });
+
+ it('handles URLs with subdomains', () => {
+ expect(extractDomain('https://docs.google.com/spreadsheets')).toBe('docs.google.com');
+ });
+});
+
+describe('getMostCommonDomain', () => {
+ it('returns the most frequent domain', () => {
+ const steps = [{ url: 'https://github.com/a' }, { url: 'https://github.com/b' }, { url: 'https://google.com/c' }];
+ expect(getMostCommonDomain(steps)).toBe('github.com');
+ });
+
+ it('returns empty string when no steps have URLs', () => {
+ expect(getMostCommonDomain([{ url: null }, { url: '' }])).toBe('');
+ });
+
+ it('returns empty string for empty array', () => {
+ expect(getMostCommonDomain([])).toBe('');
+ });
+
+ it('handles single step', () => {
+ expect(getMostCommonDomain([{ url: 'https://example.com' }])).toBe('example.com');
+ });
+});
+
+describe('getDomainInitial', () => {
+ it('returns uppercase first letter', () => {
+ const { letter } = getDomainInitial('github.com');
+ expect(letter).toBe('G');
+ });
+
+ it('returns a gradient tuple', () => {
+ const { gradient } = getDomainInitial('github.com');
+ expect(gradient).toHaveLength(2);
+ expect(gradient[0]).toMatch(/^#[0-9A-Fa-f]{6}$/);
+ expect(gradient[1]).toMatch(/^#[0-9A-Fa-f]{6}$/);
+ });
+
+ it('returns consistent gradient for the same domain', () => {
+ const a = getDomainInitial('example.com');
+ const b = getDomainInitial('example.com');
+ expect(a.gradient).toEqual(b.gradient);
+ });
+});
diff --git a/vitest.config.ts b/vitest.config.ts
index 0b69675..da8f539 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -1,11 +1,18 @@
-import { defineConfig } from 'vitest/config';
-import react from '@vitejs/plugin-react';
+import react from "@vitejs/plugin-react";
+import { configDefaults, defineConfig } from "vitest/config";
+import { WxtVitest } from "wxt/testing";
export default defineConfig({
- plugins: [react()],
+ plugins: [WxtVitest() as any, react()],
test: {
- environment: 'happy-dom',
+ exclude: [...configDefaults.exclude, "**/.claude/**", "**/.worktrees/**", "tests/**"],
+ environment: "node",
globals: true,
- include: ['tests/**/*.test.{ts,tsx}'],
+ setupFiles: "vitest.setup.ts",
+ watch: false,
+ coverage: {
+ provider: "istanbul",
+ reporter: ["text", "html", "lcov"],
+ },
},
});
diff --git a/vitest.setup.ts b/vitest.setup.ts
new file mode 100644
index 0000000..3f93d66
--- /dev/null
+++ b/vitest.setup.ts
@@ -0,0 +1,116 @@
+import { vi } from "vitest";
+import "@testing-library/jest-dom";
+
+console.log = () => {};
+console.info = () => {};
+console.warn = () => {};
+console.error = () => {};
+
+class MemoryStorage implements Storage {
+ #store = new Map<string, string>();
+
+ get length() {
+ return this.#store.size;
+ }
+
+ clear() {
+ this.#store.clear();
+ }
+
+ getItem(key: string) {
+ return this.#store.get(key) ?? null;
+ }
+
+ key(index: number) {
+ return [...this.#store.keys()][index] ?? null;
+ }
+
+ removeItem(key: string) {
+ this.#store.delete(key);
+ }
+
+ setItem(key: string, value: string) {
+ this.#store.set(key, value);
+ }
+}
+
+Object.defineProperty(globalThis, "localStorage", {
+ configurable: true,
+ value: new MemoryStorage(),
+});
+
+Object.defineProperty(globalThis, "sessionStorage", {
+ configurable: true,
+ value: new MemoryStorage(),
+});
+
+const mockI18n = {
+ i18n: {
+ t: (key: string, subs?: string[]) => {
+ if (subs?.length) return `${key}[${subs.join(",")}]`;
+ return key;
+ },
+ },
+};
+
+vi.mock("#i18n", () => mockI18n);
+
+vi.mock("#imports", () => ({
+ ...mockI18n,
+ browser: {
+ i18n: {
+ getMessage: (key: string) => key.replaceAll("_", "."),
+ getUILanguage: () => "en-US",
+ },
+ storage: { local: { get: vi.fn(), set: vi.fn(), onChanged: { addListener: vi.fn(), removeListener: vi.fn() } } },
+ runtime: { getManifest: () => ({ manifest_version: 3, name: "Mimik", version: "1.0.0" }) },
+ tabs: {},
+ },
+ defineBackground: vi.fn(),
+ defineContentScript: vi.fn(),
+}));
+
+vi.mock("wxt/testing", async () => {
+ const actual = await vi.importActual<any>("wxt/testing");
+ return {
+ ...actual,
+ fakeBrowser: {
+ ...actual.fakeBrowser,
+ i18n: {
+ ...actual.fakeBrowser.i18n,
+ getMessage: (key: string) => key.replaceAll("_", "."),
+ getUILanguage: () => "en-US",
+ },
+ runtime: {
+ ...actual.fakeBrowser.runtime,
+ getManifest: () => ({
+ manifest_version: 3,
+ name: "Mimik",
+ version: "1.0.0",
+ description: "Test manifest",
+ }),
+ },
+ },
+ };
+});
+
+class ESBuildAndJSDOMCompatibleTextEncoder extends TextEncoder {
+ constructor() {
+ super();
+ }
+
+ encode(input: string) {
+ if (typeof input !== "string") {
+ throw new TypeError("`input` must be a string");
+ }
+ const decodedURI = decodeURIComponent(encodeURIComponent(input));
+ const arr = new Uint8Array(decodedURI.length);
+ const chars = decodedURI.split("");
+ for (let i = 0; i < chars.length; i++) {
+ arr[i] = decodedURI[i].charCodeAt(0);
+ }
+ return arr;
+ }
+}
+
+globalThis.TextEncoder = ESBuildAndJSDOMCompatibleTextEncoder;