[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

fix: spy on popup apis like alert (#3076)

Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>

authored by

Mohammad Bagher Abiat
Vladimir
and committed by
GitHub
(Mar 26, 2023, 10:05 AM +0200) 280ad1ed efb91e22

+109 -91
+55 -88
pnpm-lock.yaml
··· 240 240 react-dom: 18.0.0_react@18.0.0 241 241 devDependencies: 242 242 '@testing-library/react': 13.3.0_zpnidt7m3osuk7shl3s4oenomq 243 - '@types/node': 18.15.3 243 + '@types/node': 18.15.7 244 244 '@types/react': 18.0.28 245 245 '@vitejs/plugin-react': 3.1.0 246 246 jsdom: 21.1.1 ··· 502 502 vue: latest 503 503 devDependencies: 504 504 '@vitejs/plugin-vue': 4.1.0_vite@4.0.0+vue@3.2.47 505 - '@vue/test-utils': 2.3.1_vue@3.2.47 505 + '@vue/test-utils': 2.3.2_vue@3.2.47 506 506 jsdom: 21.1.1 507 507 vite: 4.0.0 508 508 vite-plugin-ruby: 3.1.2_vite@4.0.0 ··· 596 596 devDependencies: 597 597 '@vitejs/plugin-vue': 4.1.0_vite@4.0.0+vue@3.2.47 598 598 '@vitejs/plugin-vue-jsx': 3.0.1_vite@4.0.0+vue@3.2.47 599 - '@vue/test-utils': 2.3.1_vue@3.2.47 599 + '@vue/test-utils': 2.3.2_vue@3.2.47 600 600 jsdom: 21.1.1 601 601 vite: 4.0.0 602 602 vitest: link:../../packages/vitest ··· 1093 1093 vue: latest 1094 1094 devDependencies: 1095 1095 '@vitejs/plugin-vue': 4.1.0_vite@4.0.0+vue@3.2.47 1096 - '@vue/test-utils': 2.3.1_vue@3.2.47 1096 + '@vue/test-utils': 2.3.2_vue@3.2.47 1097 1097 happy-dom: 8.9.0 1098 1098 vite: 4.0.0 1099 1099 vitest: link:../../packages/vitest ··· 1673 1673 '@babel/parser': 7.20.7 1674 1674 '@babel/template': 7.20.7 1675 1675 '@babel/traverse': 7.20.12 1676 - '@babel/types': 7.20.7 1676 + '@babel/types': 7.21.3 1677 1677 convert-source-map: 1.9.0 1678 1678 debug: 4.3.4 1679 1679 gensync: 1.0.0-beta.2 ··· 1719 1719 '@babel/parser': 7.20.7 1720 1720 '@babel/template': 7.20.7 1721 1721 '@babel/traverse': 7.20.12 1722 - '@babel/types': 7.20.7 1722 + '@babel/types': 7.21.3 1723 1723 convert-source-map: 1.9.0 1724 1724 debug: 4.3.4 1725 1725 gensync: 1.0.0-beta.2 ··· 1733 1733 resolution: {integrity: sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==} 1734 1734 engines: {node: '>=6.9.0'} 1735 1735 dependencies: 1736 - '@babel/types': 7.20.7 1736 + '@babel/types': 7.21.3 1737 1737 '@jridgewell/gen-mapping': 0.3.2 1738 1738 jsesc: 2.5.2 1739 1739 ··· 1826 1826 browserslist: 4.21.3 1827 1827 lru-cache: 5.1.1 1828 1828 semver: 6.3.0 1829 - dev: true 1830 - 1831 - /@babel/helper-create-class-features-plugin/7.20.5_@babel+core@7.20.12: 1832 - resolution: {integrity: sha512-3RCdA/EmEaikrhayahwToF0fpweU/8o2p8vhc1c/1kftHOdTKuC65kik/TLc+qfbS8JKw4qqJbne4ovICDhmww==} 1833 - engines: {node: '>=6.9.0'} 1834 - peerDependencies: 1835 - '@babel/core': ^7.0.0 1836 - dependencies: 1837 - '@babel/core': 7.20.12 1838 - '@babel/helper-annotate-as-pure': 7.18.6 1839 - '@babel/helper-environment-visitor': 7.18.9 1840 - '@babel/helper-function-name': 7.21.0 1841 - '@babel/helper-member-expression-to-functions': 7.21.0 1842 - '@babel/helper-optimise-call-expression': 7.18.6 1843 - '@babel/helper-replace-supers': 7.20.7 1844 - '@babel/helper-split-export-declaration': 7.18.6 1845 - transitivePeerDependencies: 1846 - - supports-color 1847 1829 dev: true 1848 1830 1849 1831 /@babel/helper-create-class-features-plugin/7.21.0_@babel+core@7.18.13: ··· 1986 1968 '@babel/types': 7.21.3 1987 1969 dev: true 1988 1970 1989 - /@babel/helper-function-name/7.19.0: 1990 - resolution: {integrity: sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==} 1991 - engines: {node: '>=6.9.0'} 1992 - dependencies: 1993 - '@babel/template': 7.20.7 1994 - '@babel/types': 7.21.3 1995 - 1996 1971 /@babel/helper-function-name/7.21.0: 1997 1972 resolution: {integrity: sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==} 1998 1973 engines: {node: '>=6.9.0'} ··· 2037 2012 '@babel/helper-validator-identifier': 7.19.1 2038 2013 '@babel/template': 7.20.7 2039 2014 '@babel/traverse': 7.20.12 2040 - '@babel/types': 7.20.7 2015 + '@babel/types': 7.21.3 2041 2016 transitivePeerDependencies: 2042 2017 - supports-color 2043 2018 ··· 2165 2140 dependencies: 2166 2141 '@babel/template': 7.20.7 2167 2142 '@babel/traverse': 7.20.12 2168 - '@babel/types': 7.20.7 2143 + '@babel/types': 7.21.3 2169 2144 transitivePeerDependencies: 2170 2145 - supports-color 2171 2146 ··· 2193 2168 engines: {node: '>=6.0.0'} 2194 2169 hasBin: true 2195 2170 dependencies: 2196 - '@babel/types': 7.20.7 2171 + '@babel/types': 7.21.3 2197 2172 2198 2173 /@babel/parser/7.20.7: 2199 2174 resolution: {integrity: sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==} ··· 3727 3702 '@babel/helper-module-imports': 7.18.6 3728 3703 '@babel/helper-plugin-utils': 7.20.2 3729 3704 '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.18.13 3730 - '@babel/types': 7.20.7 3705 + '@babel/types': 7.21.3 3731 3706 dev: true 3732 3707 3733 3708 /@babel/plugin-transform-react-jsx/7.19.0_@babel+core@7.18.13: ··· 3741 3716 '@babel/helper-module-imports': 7.18.6 3742 3717 '@babel/helper-plugin-utils': 7.20.2 3743 3718 '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.18.13 3744 - '@babel/types': 7.20.7 3719 + '@babel/types': 7.21.3 3745 3720 dev: true 3746 3721 3747 3722 /@babel/plugin-transform-react-jsx/7.19.0_@babel+core@7.19.6: ··· 3755 3730 '@babel/helper-module-imports': 7.18.6 3756 3731 '@babel/helper-plugin-utils': 7.20.2 3757 3732 '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.19.6 3758 - '@babel/types': 7.20.7 3733 + '@babel/types': 7.21.3 3759 3734 dev: true 3760 3735 3761 3736 /@babel/plugin-transform-react-jsx/7.19.0_@babel+core@7.20.12: ··· 3769 3744 '@babel/helper-module-imports': 7.18.6 3770 3745 '@babel/helper-plugin-utils': 7.20.2 3771 3746 '@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.20.12 3772 - '@babel/types': 7.20.7 3747 + '@babel/types': 7.21.3 3773 3748 dev: true 3774 3749 3775 3750 /@babel/plugin-transform-react-pure-annotations/7.18.6_@babel+core@7.18.13: ··· 3945 3920 '@babel/core': ^7.0.0-0 3946 3921 dependencies: 3947 3922 '@babel/core': 7.20.12 3948 - '@babel/helper-create-class-features-plugin': 7.20.5_@babel+core@7.20.12 3923 + '@babel/helper-create-class-features-plugin': 7.21.0_@babel+core@7.20.12 3949 3924 '@babel/helper-plugin-utils': 7.20.2 3950 3925 '@babel/plugin-syntax-typescript': 7.20.0_@babel+core@7.20.12 3951 3926 transitivePeerDependencies: ··· 4318 4293 dependencies: 4319 4294 '@babel/code-frame': 7.18.6 4320 4295 '@babel/parser': 7.20.7 4321 - '@babel/types': 7.20.7 4296 + '@babel/types': 7.21.3 4322 4297 4323 4298 /@babel/template/7.20.7: 4324 4299 resolution: {integrity: sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==} ··· 4335 4310 '@babel/code-frame': 7.18.6 4336 4311 '@babel/generator': 7.20.7 4337 4312 '@babel/helper-environment-visitor': 7.18.9 4338 - '@babel/helper-function-name': 7.19.0 4313 + '@babel/helper-function-name': 7.21.0 4339 4314 '@babel/helper-hoist-variables': 7.18.6 4340 4315 '@babel/helper-split-export-declaration': 7.18.6 4341 4316 '@babel/parser': 7.20.7 4342 - '@babel/types': 7.20.7 4317 + '@babel/types': 7.21.3 4343 4318 debug: 4.3.4 4344 4319 globals: 11.12.0 4345 4320 transitivePeerDependencies: ··· 4364 4339 4365 4340 /@babel/types/7.18.13: 4366 4341 resolution: {integrity: sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==} 4367 - engines: {node: '>=6.9.0'} 4368 - dependencies: 4369 - '@babel/helper-string-parser': 7.19.4 4370 - '@babel/helper-validator-identifier': 7.19.1 4371 - to-fast-properties: 2.0.0 4372 - 4373 - /@babel/types/7.20.7: 4374 - resolution: {integrity: sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==} 4375 4342 engines: {node: '>=6.9.0'} 4376 4343 dependencies: 4377 4344 '@babel/helper-string-parser': 7.19.4 ··· 5088 5055 dependencies: 5089 5056 '@types/istanbul-lib-coverage': 2.0.4 5090 5057 '@types/istanbul-reports': 3.0.1 5091 - '@types/node': 18.15.3 5058 + '@types/node': 18.15.7 5092 5059 '@types/yargs': 15.0.14 5093 5060 chalk: 4.1.2 5094 5061 dev: true ··· 5100 5067 '@jest/schemas': 29.0.0 5101 5068 '@types/istanbul-lib-coverage': 2.0.4 5102 5069 '@types/istanbul-reports': 3.0.1 5103 - '@types/node': 18.15.3 5070 + '@types/node': 18.15.7 5104 5071 '@types/yargs': 17.0.12 5105 5072 chalk: 4.1.2 5106 5073 dev: true ··· 5612 5579 engines: {node: '>=14'} 5613 5580 hasBin: true 5614 5581 dependencies: 5615 - '@types/node': 18.15.3 5582 + '@types/node': 18.15.7 5616 5583 playwright-core: 1.28.0 5617 5584 dev: true 5618 5585 ··· 6896 6863 '@babel/generator': 7.20.7 6897 6864 '@babel/parser': 7.20.7 6898 6865 '@babel/preset-env': 7.18.10_@babel+core@7.18.13 6899 - '@babel/types': 7.20.7 6866 + '@babel/types': 7.21.3 6900 6867 '@mdx-js/mdx': 1.6.22 6901 6868 '@mdx-js/react': 1.6.22_react@17.0.2 6902 6869 '@types/lodash': 4.14.191 ··· 7450 7417 /@types/cheerio/0.22.31: 7451 7418 resolution: {integrity: sha512-Kt7Cdjjdi2XWSfrZ53v4Of0wG3ZcmaegFXjMmz9tfNrZSkzzo36G0AL1YqSdcIA78Etjt6E609pt5h1xnQkPUw==} 7452 7419 dependencies: 7453 - '@types/node': 18.15.3 7420 + '@types/node': 18.15.7 7454 7421 dev: true 7455 7422 7456 7423 /@types/codemirror/5.60.6: ··· 7517 7484 resolution: {integrity: sha512-zdV5odfHf95B4qr6bdpshG4VMm/3xgnPhSJLa3xh75CYr35e34k+4FQli82Q48sPqwHazJGy+6+jl4T+Vw1AMg==} 7518 7485 dependencies: 7519 7486 '@types/jsonfile': 6.1.1 7520 - '@types/node': 18.15.3 7487 + '@types/node': 18.15.7 7521 7488 dev: true 7522 7489 7523 7490 /@types/fs-extra/9.0.13: 7524 7491 resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} 7525 7492 dependencies: 7526 - '@types/node': 18.15.3 7493 + '@types/node': 18.15.7 7527 7494 dev: true 7528 7495 7529 7496 /@types/glob/7.2.0: 7530 7497 resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} 7531 7498 dependencies: 7532 7499 '@types/minimatch': 5.1.1 7533 - '@types/node': 18.15.3 7500 + '@types/node': 18.15.7 7534 7501 dev: true 7535 7502 7536 7503 /@types/glob/8.0.0: 7537 7504 resolution: {integrity: sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==} 7538 7505 dependencies: 7539 7506 '@types/minimatch': 5.1.1 7540 - '@types/node': 18.15.3 7507 + '@types/node': 18.15.7 7541 7508 dev: true 7542 7509 7543 7510 /@types/graceful-fs/4.1.5: 7544 7511 resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} 7545 7512 dependencies: 7546 - '@types/node': 18.15.3 7513 + '@types/node': 18.15.7 7547 7514 dev: true 7548 7515 7549 7516 /@types/hast/2.3.4: ··· 7608 7575 /@types/jsdom/21.1.0: 7609 7576 resolution: {integrity: sha512-leWreJOdnuIxq9Y70tBVm/bvTuh31DSlF/r4l7Cfi4uhVQqLHD0Q4v301GMisEMwwbMgF7ZKxuZ+Jbd4NcdmRw==} 7610 7577 dependencies: 7611 - '@types/node': 18.15.3 7578 + '@types/node': 18.15.7 7612 7579 '@types/tough-cookie': 4.0.2 7613 7580 parse5: 7.1.1 7614 7581 dev: true ··· 7624 7591 /@types/jsonfile/6.1.1: 7625 7592 resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==} 7626 7593 dependencies: 7627 - '@types/node': 18.15.3 7594 + '@types/node': 18.15.7 7628 7595 dev: true 7629 7596 7630 7597 /@types/lodash/4.14.191: ··· 7658 7625 /@types/node-fetch/2.6.2: 7659 7626 resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} 7660 7627 dependencies: 7661 - '@types/node': 18.15.3 7628 + '@types/node': 18.15.7 7662 7629 form-data: 3.0.1 7663 7630 dev: true 7664 7631 ··· 7674 7641 resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} 7675 7642 dev: true 7676 7643 7677 - /@types/node/18.15.3: 7678 - resolution: {integrity: sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==} 7644 + /@types/node/18.15.7: 7645 + resolution: {integrity: sha512-LFmUbFunqmBn26wJZgZPYZPrDR1RwGOu2v79Mgcka1ndO6V0/cwjivPTc4yoK6n9kmw4/ls1r8cLrvh2iMibFA==} 7679 7646 dev: true 7680 7647 7681 7648 /@types/node/18.7.13: ··· 7708 7675 /@types/prompts/2.4.2: 7709 7676 resolution: {integrity: sha512-TwNx7qsjvRIUv/BCx583tqF5IINEVjCNqg9ofKHRlSoUHE62WBHrem4B1HGXcIrG511v29d1kJ9a/t2Esz7MIg==} 7710 7677 dependencies: 7711 - '@types/node': 18.15.3 7678 + '@types/node': 18.15.7 7712 7679 kleur: 3.0.3 7713 7680 dev: true 7714 7681 ··· 7781 7748 /@types/resolve/1.17.1: 7782 7749 resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} 7783 7750 dependencies: 7784 - '@types/node': 18.15.3 7751 + '@types/node': 18.15.7 7785 7752 dev: true 7786 7753 7787 7754 /@types/resolve/1.20.2: ··· 7798 7765 /@types/set-cookie-parser/2.4.2: 7799 7766 resolution: {integrity: sha512-fBZgytwhYAUkj/jC/FAV4RQ5EerRup1YQsXQCh8rZfiHkc4UahC192oH0smGwsXol3cL3A5oETuAHeQHmhXM4w==} 7800 7767 dependencies: 7801 - '@types/node': 18.15.3 7768 + '@types/node': 18.15.7 7802 7769 dev: true 7803 7770 7804 7771 /@types/sinonjs__fake-timers/8.1.1: ··· 7872 7839 /@types/webpack-sources/3.2.0: 7873 7840 resolution: {integrity: sha512-Ft7YH3lEVRQ6ls8k4Ff1oB4jN6oy/XmU6tQISKdhfh+1mR+viZFphS6WL0IrtDOzvefmJg5a0s7ZQoRXwqTEFg==} 7874 7841 dependencies: 7875 - '@types/node': 18.15.3 7842 + '@types/node': 18.15.7 7876 7843 '@types/source-list-map': 0.1.2 7877 7844 source-map: 0.7.4 7878 7845 dev: true ··· 7880 7847 /@types/webpack/4.41.32: 7881 7848 resolution: {integrity: sha512-cb+0ioil/7oz5//7tZUSwbrSAN/NWHrQylz5cW8G0dWTcF/g+/dSdMlKVZspBYuMAN1+WnwHrkxiRrLcwd0Heg==} 7882 7849 dependencies: 7883 - '@types/node': 18.15.3 7850 + '@types/node': 18.15.7 7884 7851 '@types/tapable': 1.0.8 7885 7852 '@types/uglify-js': 3.17.0 7886 7853 '@types/webpack-sources': 3.2.0 ··· 7895 7862 /@types/ws/8.5.4: 7896 7863 resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} 7897 7864 dependencies: 7898 - '@types/node': 18.15.3 7865 + '@types/node': 18.15.7 7899 7866 dev: true 7900 7867 7901 7868 /@types/yargs-parser/21.0.0: ··· 7918 7885 resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} 7919 7886 requiresBuild: true 7920 7887 dependencies: 7921 - '@types/node': 18.15.3 7888 + '@types/node': 18.15.7 7922 7889 dev: true 7923 7890 optional: true 7924 7891 ··· 8752 8719 vue: 3.2.47 8753 8720 dev: true 8754 8721 8755 - /@vue/test-utils/2.3.1_vue@3.2.47: 8756 - resolution: {integrity: sha512-tRtHRPEETQSUrqXgAewNZHm5iypxDFxwenfdcvMRm1kbGo4bcqHb1XHHlsaIjoDbLkuE2NYiF8vBQDNYrzlrSA==} 8722 + /@vue/test-utils/2.3.2_vue@3.2.47: 8723 + resolution: {integrity: sha512-hJnVaYhbrIm0yBS0+e1Y0Sj85cMyAi+PAbK4JHqMRUZ6S622Goa+G7QzkRSyvCteG8wop7tipuEbHoZo26wsSA==} 8757 8724 peerDependencies: 8758 8725 vue: ^3.0.1 8759 8726 dependencies: ··· 8920 8887 resolution: {integrity: sha512-96G4TzbYnRf95+GURo15FYt6iTYq85nbWU6YQedLRAV15RfSp4foKTbAnq++bKKMALNL6gdzTc+HGhQr3Q0sQg==} 8921 8888 engines: {node: ^16.13 || >=18} 8922 8889 dependencies: 8923 - '@types/node': 18.15.3 8890 + '@types/node': 18.15.7 8924 8891 dev: true 8925 8892 8926 8893 /@wdio/types/8.4.0: 8927 8894 resolution: {integrity: sha512-1eA0D0jS8Ttg67zB2gsZJFUcHcRz4VRjLTjxdLKh70+ZfB1+YZr9tScLgQjc+qsjsK1wKSzOz03uZiidwNnN9g==} 8928 8895 engines: {node: ^16.13 || >=18} 8929 8896 dependencies: 8930 - '@types/node': 18.15.3 8897 + '@types/node': 18.15.7 8931 8898 dev: true 8932 8899 8933 8900 /@wdio/utils/8.6.1: ··· 10806 10773 engines: {node: '>=12.13.0'} 10807 10774 hasBin: true 10808 10775 dependencies: 10809 - '@types/node': 18.15.3 10776 + '@types/node': 18.15.7 10810 10777 escape-string-regexp: 4.0.0 10811 10778 is-wsl: 2.2.0 10812 10779 lighthouse-logger: 1.3.0 ··· 11999 11966 resolution: {integrity: sha512-dqR5SUsqpJBkY+SpzSPyRwAdwn3PdoCFjgaRqO2jkF0IXgvBkKsXSepAN2QV4/nbcFXB6mokJZ0rlHSzVl7GkQ==} 12000 11967 engines: {node: ^16.13 || >=18} 12001 11968 dependencies: 12002 - '@types/node': 18.15.3 11969 + '@types/node': 18.15.7 12003 11970 '@wdio/config': 8.6.2 12004 11971 '@wdio/logger': 8.1.0 12005 11972 '@wdio/protocols': 8.5.7 ··· 15364 15331 dependencies: 15365 15332 '@jest/types': 26.6.2 15366 15333 '@types/graceful-fs': 4.1.5 15367 - '@types/node': 18.15.3 15334 + '@types/node': 18.15.7 15368 15335 anymatch: 3.1.2 15369 15336 fb-watchman: 2.0.1 15370 15337 graceful-fs: 4.2.10 ··· 15432 15399 resolution: {integrity: sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g==} 15433 15400 engines: {node: '>= 10.14.2'} 15434 15401 dependencies: 15435 - '@types/node': 18.15.3 15402 + '@types/node': 18.15.7 15436 15403 graceful-fs: 4.2.10 15437 15404 dev: true 15438 15405 ··· 15441 15408 engines: {node: '>= 10.14.2'} 15442 15409 dependencies: 15443 15410 '@jest/types': 26.6.2 15444 - '@types/node': 18.15.3 15411 + '@types/node': 18.15.7 15445 15412 chalk: 4.1.2 15446 15413 graceful-fs: 4.2.10 15447 15414 is-ci: 2.0.0 ··· 15453 15420 engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} 15454 15421 dependencies: 15455 15422 '@jest/types': 29.0.1 15456 - '@types/node': 18.15.3 15423 + '@types/node': 18.15.7 15457 15424 chalk: 4.1.2 15458 15425 ci-info: 3.7.0 15459 15426 graceful-fs: 4.2.10 ··· 15464 15431 resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} 15465 15432 engines: {node: '>= 10.13.0'} 15466 15433 dependencies: 15467 - '@types/node': 18.15.3 15434 + '@types/node': 18.15.7 15468 15435 merge-stream: 2.0.0 15469 15436 supports-color: 7.2.0 15470 15437 dev: true ··· 15473 15440 resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} 15474 15441 engines: {node: '>= 10.13.0'} 15475 15442 dependencies: 15476 - '@types/node': 18.15.3 15443 + '@types/node': 18.15.7 15477 15444 merge-stream: 2.0.0 15478 15445 supports-color: 8.1.1 15479 15446 dev: true ··· 19897 19864 dependencies: 19898 19865 '@babel/generator': 7.20.7 19899 19866 '@babel/helper-module-imports': 7.18.6 19900 - '@babel/types': 7.20.7 19867 + '@babel/types': 7.21.3 19901 19868 solid-js: 1.5.2 19902 19869 dev: true 19903 19870 ··· 22259 22226 resolution: {integrity: sha512-jgnu/hB7O8hrjCZm6zW77QhBEdwteQF+liWvjZcflQXUmS/YLdS/UAfCBQzt1CIUHfbGrlxHshwFm+ywjT9XJw==} 22260 22227 engines: {node: ^16.13 || >=18} 22261 22228 dependencies: 22262 - '@types/node': 18.15.3 22229 + '@types/node': 18.15.7 22263 22230 '@types/ws': 8.5.4 22264 22231 '@wdio/config': 8.6.2 22265 22232 '@wdio/logger': 8.1.0 ··· 22279 22246 resolution: {integrity: sha512-XhS6lydSyCLnJcOBhLbSK6J0MQdfnSXaFcSvSEL10TMBnWcmETCfYIj7OX41weDI8F4YAasYyMH+mJUkWwC1Ww==} 22280 22247 engines: {node: ^16.13 || >=18} 22281 22248 dependencies: 22282 - '@types/node': 18.15.3 22249 + '@types/node': 18.15.7 22283 22250 '@wdio/config': 8.6.2 22284 22251 '@wdio/logger': 8.1.0 22285 22252 '@wdio/protocols': 8.5.7
+9 -2
docs/guide/browser.md
··· 1 1 --- 2 - title: Browser mode | Guide 2 + title: Browser Mode | Guide 3 3 --- 4 4 5 - # Browser mode (experimental) 5 + # Browser Mode (experimental) 6 6 7 7 This page provides information about the experimental browser mode feature in the Vitest API, which allows you to run your tests in the browser natively, providing access to browser globals like window and document. This feature is currently under development, and APIs may change in the future. 8 8 ··· 87 87 ``` 88 88 89 89 In this case, Vitest will run in headless mode using the Chrome browser. 90 + 91 + ## Limitations 92 + ### Thread Blocking Dialogs 93 + 94 + When using Vitest Browser, it's important to note that thread blocking dialogs like `alert` or `confirm` cannot be used natively. This is because they block the web page, which means Vitest cannot continue communicating with the page, causing the execution to hang. 95 + 96 + In such situations, Vitest provides default mocks with default returned values for these APIs. This ensures that if the user accidentally uses synchronous popup web APIs, the execution would not hang. However, it's still recommended for the user to mock these web APIs for better experience. Read more in [Mocking](/guide/mocking).
+7 -1
test/browser/specs/runner.test.mjs
··· 17 17 const browserResult = await readFile('./browser.json', 'utf-8') 18 18 const browserResultJson = JSON.parse(browserResult) 19 19 20 - assert.ok(browserResultJson.testResults.length === 5, 'Not all the tests have been run') 20 + assert.ok(browserResultJson.testResults.length === 6, 'Not all the tests have been run') 21 21 22 22 for (const result of browserResultJson.testResults) 23 23 assert.ok(result.status === 'passed', `${result.name} has failed`) ··· 48 48 assert.match(stderr, /hello from console.warn/, 'prints console.info') 49 49 assert.match(stderr, /Timer "invalid timeLog" does not exist/, 'prints errored timeLog') 50 50 assert.match(stderr, /Timer "invalid timeEnd" does not exist/, 'prints errored timeEnd') 51 + }) 52 + 53 + test('popup apis should log a warning', () => { 54 + assert.ok(stderr.includes('Vitest encountered a \`alert\("test"\)\`'), 'prints warning for alert') 55 + assert.ok(stderr.includes('Vitest encountered a \`confirm\("test"\)\`'), 'prints warning for confirm') 56 + assert.ok(stderr.includes('Vitest encountered a \`prompt\("test"\)\`'), 'prints warning for prompt') 51 57 })
+15
test/browser/test/dialog.test.ts
··· 1 + /* eslint-disable no-alert */ 2 + 3 + import { expect, it } from 'vitest' 4 + 5 + it('alert', async () => { 6 + expect(alert('test')).toBeUndefined() 7 + }) 8 + 9 + it('prompt', async () => { 10 + expect(prompt('test')).toBeNull() 11 + }) 12 + 13 + it('confirm', async () => { 14 + expect(confirm('test')).toBe(false) 15 + })
+21
packages/browser/src/client/dialog.ts
··· 1 + const showPopupWarning = <T>(name: string, value: T, defaultValue?: T) => (...params: any[]) => { 2 + const formatedParams = params.map(p => JSON.stringify(p)).join(', ') 3 + 4 + console.warn(`Vitest encountered a \`${name}(${formatedParams})\` call that it cannot handle by default, so it returned \`${value}\`. Read more in https://vitest.dev/guide/browser#thread-blocking-dialogs. 5 + If needed, mock the \`${name}\` call manually like: 6 + 7 + \`\`\` 8 + import { expect, vi } from "vitest" 9 + 10 + vi.spyOn(window, "${name}")${defaultValue ? `.mockReturnValue(${JSON.stringify(defaultValue)})` : ''} 11 + ${name}(${formatedParams}) 12 + expect(${name}).toHaveBeenCalledWith(${formatedParams}) 13 + \`\`\``) 14 + return value 15 + } 16 + 17 + export const setupDialogsSpy = () => { 18 + globalThis.alert = showPopupWarning('alert', undefined) 19 + globalThis.confirm = showPopupWarning('confirm', false, true) 20 + globalThis.prompt = showPopupWarning('prompt', null, 'your value') 21 + }
+2
packages/browser/src/client/main.ts
··· 7 7 import { importId } from './utils' 8 8 import { setupConsoleLogSpy } from './logger' 9 9 import { createSafeRpc, rpc, rpcDone } from './rpc' 10 + import { setupDialogsSpy } from './dialog' 10 11 11 12 // @ts-expect-error mocking some node apis 12 13 globalThis.process = { env: {}, argv: [], cwd: () => '/', stdout: { write: () => {} }, nextTick: cb => cb() } ··· 71 72 iFrame.setAttribute('src', '/__vitest__/') 72 73 73 74 await setupConsoleLogSpy() 75 + setupDialogsSpy() 74 76 await runTests(paths, config) 75 77 }) 76 78