倒数是什么| 结肠和直肠有什么区别| 身体缺钾是什么原因造成的| 什么是气血| 水逆退散是什么意思| 什么命的人会丧偶| 六月五日是什么日子| 升白针是什么药| 慢热是什么意思| 蓝痣有没有什么危害| 美国为什么那么强大| 息肌丸是什么| 咳嗽不能吃什么| 中唐筛查是检查什么| 罄竹难书的罄什么意思| 浮粉是什么原因引起的| 心慌气短吃什么药最好| 吃枸杞有什么功效| 北面是什么档次的牌子| 什么叫窝沟封闭| 胸疼是什么原因引起的| peaches是什么意思| 为什么邓超对鹿晗很好| 12月14号是什么星座| 梦见手指流血是什么预兆| maggie是什么意思| 梦到别人怀孕是什么意思| 党参有什么功效| 75c是什么罩杯| 西天取经是什么意思| 糜烂性胃炎吃什么药| 高笋和茭白有什么区别| 非私营单位是什么| 吃什么美容养颜抗衰老| 34周为什么不建议保胎| 保肝护肝吃什么药好| 开塞露是干什么用的| 吃燕麦片有什么好处| 夏天什么花会开| 天空为什么是蓝色的| 四叶草的寓意是什么| 儿女双全是什么意思| 肺阴虚吃什么药| 什么水果维生素c含量最高| 亢奋什么意思| 长期贫血会导致什么严重后果| 爱迪生发明什么| 饿了么什么时候成立的| 为什么指甲有竖纹| mrsa是什么细菌| 眼结石是什么原因引起的| 亦的意思是什么| a4纸可以折什么| 硬发质适合什么发型| 生理期吃什么比较好| 喝中药不能吃什么东西| 结婚下大雨是什么兆头| 一个巾一个童读什么| 甲基苯丙胺是什么| 手脚麻木是什么原因| 小猫什么时候断奶| 月经前是什么期| 肝有钙化灶是什么意思| 生活是什么| 卦不走空是什么意思| 结果是什么意思| 甲亢平时要注意什么| 孕妇血糖高对胎儿有什么影响| 复方氯化钠注射作用是什么| 皮肤瘙痒用什么药治疗| 吃什么生精养精最快| ln是什么| 血小板偏低是什么意思| 檀木手串有什么好处| 腺样体是什么| 话少一般都是什么人| 肉筋是什么| 北北是什么意思| 浪子回头金不换是什么意思| 金钱草长什么样| 去疤痕挂什么科| 打疫苗挂什么科| 大便干是什么原因| 胆结石是什么原因导致的| 红线是什么意思| 头臀长是什么意思| 白带褐色什么原因| 女性肾虚吃什么药| 非转基因是什么意思| 纳米是什么意思| 检查尿酸挂什么科| 开荤是什么意思| 孽缘什么意思| 灰指甲用什么药效果好| 梦见吃花生是什么意思| 鼻塞黄鼻涕吃什么药| 牛肉粉是什么调料| 束缚是什么意思| 气阴两虚是什么意思| 荨麻疹不能吃什么食物| 外冷内热是什么症状| 什么才是真正的爱情| 2024年是什么年| 拷贝是什么意思| 阿拉伯是什么意思| 什么的哲理| 守宫是什么意思| 卵子是什么| 农历闰月有什么规律| 人突然消瘦是什么原因| 肚子拉稀像水一样是什么情况| 舌头麻木吃什么药| 月经吃什么水果| 佳偶天成是什么意思| 甲骨文是什么朝代的| 做梦梦见火是什么意思| 猫咪掉胡子是什么原因| 打磨工为什么没人干| 香港特首什么级别| 耳机降噪是什么意思| 呼吸重是什么原因| 四季平安是什么生肖| 面色晄白是什么意思| 脸色发黑是什么原因| 脚底发红是什么原因| 珙桐属于什么植物| 空调除湿是什么标志| 吃什么食物可以降尿酸| lg是什么| 紫玫瑰花语是什么意思| 胎儿缺氧是什么原因造成的| 什么不及什么| kms是什么药| 泌尿系统感染吃什么药| 裸眼视力是什么意思| 心跳突然加快是什么原因| pp1是什么意思| 时点是什么意思| 长痘痘用什么药| 不寐病是什么意思| 腹腔淋巴结肿大是什么原因| 龄字五行属什么| 本科毕业证是什么颜色| 散光跟近视有什么区别| 胸腺瘤是什么病| 1.28什么星座| 虚恋是什么意思| 补气吃什么食物| 蟑螂讨厌什么味道| 1977年属什么| 生辰八字查五行缺什么| 为什么男的叫鸭子| 琳五行属什么| 接吻什么感觉| 肠道门诊看什么病| 私处长痘痘是什么原因| 身份证最后一位代表什么| 高血糖吃什么菜好| 喝酒胃出血是什么症状| 头发有点黄是什么原因| 身上长红点是什么原因| 建设性意见是什么意思| 一个金字旁一个各念什么| 手上三条线分别代表什么| 便秘用什么方法治| 什么时候| 活检是什么| 球蛋白偏低是什么原因| 女孩断掌纹代表什么| 神器积分换什么最划算| 梦到知了猴是什么意思| 鱼周念什么| 氯胺酮是什么| 中暑了喝什么| 五行缺什么查询免费| 正常白带什么样| 两个脚脖子肿什么原因| 刚出生的宝宝要注意什么| 晚上睡觉手麻木是什么原因| 女人大腿内侧黑是什么原因引起的| 吃石斛有什么功效| 什么产品祛斑效果最好| 甲沟炎去医院挂什么科| 属虎和什么属相相冲| 罗红霉素和红霉素有什么区别| 什么叫眼睛散光| 骨折吃什么钙片| 肝风上扰会有什么症状| 凤梨是什么| 抛光是什么意思| h1什么意思| 梅菜在北方叫什么菜| 尿道感染看什么科| 什么时候跑步最好| 结肠炎有什么症状表现| 什么是抗生素类药物| 磨破皮了涂什么药| 一代宗师是什么意思| 脑血管堵塞有什么症状| 1945年属什么生肖| 断奶吃什么| 什么叫杵状指| aemape是什么牌子| 4月28号是什么星座| 喝什么去湿气最好最快| 豆粕是什么| 鸡冲什么生肖| 小人难防前一句是什么| 谷氨酰胺是什么| 胸内科主要看什么病| tvb为什么演员都走了| 西洋参有什么作用和功效| brat什么意思| 四肢肌力5级什么意思| 痰中带血吃什么药| 日本艺伎是干什么的| 兆以上的计数单位是什么| s925是什么意思| 拔罐紫色说明什么| 胆囊炎用什么药| 仪仗队是什么意思| 什么不绝| 狗狗吃胡萝卜有什么好处| 木人石心是什么意思| sandals是什么意思| 梦见男人是什么意思| 什么快递可以寄活物| 一对什么| 女人梦到被蛇咬是什么意思| 甲状腺素高是什么原因| 1907年属什么生肖| 吉利丁片是什么做的| 帕金森挂什么科| 流鼻血什么原因| 巧克力囊肿有什么症状表现| 吐血是什么原因引起的| 项羽是什么生肖| 做梦梦到剪头发是什么意思| 流云是什么意思| 福建岩茶属于什么茶| 吸血鬼初拥是什么意思| 星星为什么会眨眼睛| 与世无争是什么意思| 泌乳素过高女性会出现什么症状| 梦见跟妈妈吵架是什么意思| 党参和丹参有什么区别| rh因子阳性是什么意思| 吃荔枝有什么好处| 巴氏杀菌是什么意思| 绿壳鸡蛋是什么鸡生的| ab和ab生的孩子是什么血型| 05是什么生肖| 汗血宝马什么意思| 国手什么意思| 印度人是什么人种| 掉头发缺少什么维生素| 签注什么意思| 什么是阿尔兹海默症| 流沙是什么意思| 月经时间过长是什么原因引起的| 珀莱雅适合什么年龄| 鸟字旁的字大多和什么有关| 波涛澎湃是什么意思| 盐酸二甲双胍缓释片什么时候吃| 百度
Skip to content

Make unit tests run in a browser #1622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Conversation

peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Dec 31, 2024

This mega-PR rewrites unit tests so they can be run in a web browser (for now Chrome + Firefox), through webdriverio - just like our integration and memory tests.

This allows us to run unit tests in the actual environment where the RxPlayer will run and to have a common script + environment for unit, integration and memory tests, thus simplifying the project.

The main difficulty was linked to our over-reliance on vitest's doMock+importActual functions, the second which has a different behavior when run in a web browser: multiple importActual calls in the same test file won't re-evaluate that imported file. This means that doMock performed in-between importActual calls for the same file won't have an impact on that file.

This might be fixed in the future, but I wanted to see how most people succeeded to run vitest in a browser. It seems that relying on a top-level mock function is much more idiomatic, while relying on the hoisted function to also declare hoisted mocks whose implementation can change in-between tests.

Though, to ensure portability between test frameworks if we ever change it (JavaScript is like that sometimes), I try to limit reliance on that vitest-specific vi.mock/vi.hoisted concept, by prefering just mocking through only the more portable spyOn when possible.

@peaBerberian peaBerberian added the tests Relative to the RxPlayer's tests label Dec 31, 2024
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch 2 times, most recently from 25327f8 to f7d5638 Compare December 31, 2024 16:49
@peaBerberian peaBerberian force-pushed the misc/env-detector-refacto branch from d05cafc to c6858a6 Compare January 28, 2025 14:03
@peaBerberian peaBerberian added the Priority: 3 (Low) This issue or PR has a low priority. label Feb 26, 2025
@peaBerberian peaBerberian force-pushed the misc/env-detector-refacto branch from c6858a6 to 8bed678 Compare April 22, 2025 13:30
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch from d598ebd to b311011 Compare April 22, 2025 13:46
@peaBerberian peaBerberian force-pushed the misc/env-detector-refacto branch from 8bed678 to 5876dd2 Compare April 22, 2025 18:27
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch 2 times, most recently from c1519dc to 79b04e5 Compare April 22, 2025 20:15
@canalplus canalplus deleted a comment from github-actions bot Apr 22, 2025
@peaBerberian peaBerberian force-pushed the misc/env-detector-refacto branch from 5876dd2 to 5661c8b Compare June 30, 2025 10:46
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch from 0c9775a to 68ec707 Compare June 30, 2025 12:40
@canalplus canalplus deleted a comment from github-actions bot Jun 30, 2025
@canalplus canalplus deleted a comment from github-actions bot Jun 30, 2025
@peaBerberian peaBerberian changed the base branch from misc/env-detector-refacto to dev July 8, 2025 10:51
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch from 68ec707 to 049153c Compare July 8, 2025 11:44
@peaBerberian peaBerberian force-pushed the misc/vitest-browser2 branch from 049153c to 747a27d Compare August 1, 2025 13:26
Copy link

github-actions bot commented Aug 1, 2025

? Automated performance checks have passed on commit 726200f37b5d3d04ac91d72d0d0016bcfca5843d with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 18.94ms -> 19.17ms (-0.231ms, z: 0.80197) 26.10ms -> 26.10ms
seeking 16.94ms -> 14.94ms (2.007ms, z: 0.85447) 10.65ms -> 10.65ms
audio-track-reload 25.47ms -> 25.54ms (-0.075ms, z: 0.32319) 37.20ms -> 37.20ms
cold loading multithread 45.27ms -> 44.55ms (0.726ms, z: 14.07348) 66.90ms -> 65.70ms
seeking multithread 44.94ms -> 39.01ms (5.929ms, z: 0.76597) 9.95ms -> 10.05ms
audio-track-reload multithread 25.10ms -> 25.14ms (-0.037ms, z: 0.82929) 37.05ms -> 36.90ms
hot loading multithread 14.45ms -> 14.32ms (0.129ms, z: 5.42006) 21.15ms -> 21.00ms

@canalplus canalplus deleted a comment from github-actions bot Aug 1, 2025
@canalplus canalplus deleted a comment from github-actions bot Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 3 (Low) This issue or PR has a low priority. tests Relative to the RxPlayer's tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
痣是什么 食欲不振吃什么药 唯有读书高的前一句是什么 98年属什么的 人走了说什么安慰的话
恪尽职守什么意思 人生的意义是什么 马华念什么字 gaba是什么 咬牙齿是什么原因
梦见木头是什么意思 补气血吃什么最好最快 囊性结节是什么意思 受罪是什么意思 指甲月牙白代表什么
脆皖鱼是什么鱼 撸什么意思 肺大泡是什么原因造成的 生长纹是什么原因 怕热不怕冷是什么体质
氢化聚异丁烯是什么hcv9jop2ns1r.cn 素海参是什么做的hcv9jop3ns6r.cn 气胸什么症状hcv9jop1ns5r.cn 女性漏尿吃什么药最好hcv9jop0ns5r.cn 6.20是什么星座hcv7jop6ns5r.cn
小清新是什么意思啊hcv8jop6ns9r.cn 查血糖是什么检查项目1949doufunao.com 胃黏膜受损是什么症状hcv8jop7ns9r.cn 深海鱼油什么时候吃最好hcv9jop6ns5r.cn 螨虫用什么药膏hcv7jop6ns6r.cn
虚火是什么意思hcv8jop7ns9r.cn 本来无一物何处惹尘埃是什么意思hcv9jop0ns3r.cn 黑色碳素笔是什么hcv8jop9ns6r.cn 狗不能吃什么东西0735v.com 长期手淫有什么危害hcv8jop9ns0r.cn
见招拆招下一句是什么hcv7jop5ns0r.cn 吃什么可以快速美白0735v.com 结婚五周年是什么婚hcv9jop3ns2r.cn 待寝什么意思hcv8jop7ns7r.cn 白羊女跟什么星座最配hcv8jop5ns2r.cn
百度