Cannot use `dont-cleanup-after-each` in browser
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, react
- 领域
- testing-qa
调研方向
首先检查 dont-cleanup-after-each.js 以及 issue 中描述的浏览器设置;验证它在 Node 外部加载时为何会引用 process。在基于浏览器的测试设置中重现该失败,然后确认禁用 cleanup 以及相关的 ACT 行为后能够正常工作,且不会出现 ReferenceError。
由索引模型根据 Issue 内容生成。
描述
@testing-library/reactversion: 13.3.0- Testing Framework and version: Storybook 6.5.9
- DOM Environment: Browser
Relevant code or config:
import '@testing-library/react/dont-cleanup-after-each';
What you did:
I'm trying to update to react 18, but am getting errors about act not being available in production builds of react. So, I tried setting globalThis.IS_REACT_ACT_ENVIRONMENT = false, but found that this library automatically sets it to true, so to disable it I tried to import dont-cleanup-after-each as instructed in https://testing-library.com/docs/react-testing-library/setup#skipping-auto-cleanup, since https://github.com/testing-library/react-testing-library/pull/994 said to disable it the same way as cleanup.
What happened:
Uncaught ReferenceError: process is not defined
at dont-cleanup-after-each.js:1:1
This is because process does not exist in browsers, which is where I'm running RTL.
Reproduction:
Problem description:
I can't disable the use of ACT, it seems, which causes my tests to fail.
Suggested solution:
If process is not defined, you could check for import.meta.env and use that instead.
- 主要语言
- JavaScript
- 星标
- 479
- 派生
- 738
- 平均合并
- 5 天 1 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testing-library/testing-library-docs 的其他 Issue
-
Broken Chrome Extension Link in Queries Docs可能已有人在做 @rajanpanth 于 65 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 72/100
testing-library/testing-library-docs#1499 ·
维护者通常 4 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
testing-library/testing-library-docs#1528 ·
维护者通常 4 天内回复
-
Framework wrappers and DOM testing library可能已有人在做 @jacklaurencegaray 于 427 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 38/100
testing-library/testing-library-docs#1493 · 3 条评论 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 55/100
testing-library/testing-library-docs#1486 · 1 个 reaction ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 48/100
testing-library/testing-library-docs#1485 · 1 条评论 ·
维护者通常 4 天内回复
查看 testing-library/testing-library-docs 的全部 Issue
相似的 Issue
-
fix(套件): test_bundle 往仓库的 preset/skills 写哨兵,并发跑的 test_installer 拷贝时撞 ENOENT(CI 红)可能已有人在做 @Miaotofu01 今天认领。 未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
Miaotofu01/Study-Mate#216 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
-
beginner-friendly category:fixtures community enhancement first-timers-only good first issue hacktoberfest help wanted low hanging fruit micro-contribution type: task up-for-grabs
难度 1/5 1 小时以内 新手友好度 85/100
Berserk-hub150/skillhawk#229 · 1 条评论 ·
维护者通常 8 天内回复
-
WlanConfUpdateSensor falsely reports wifi interface appearing when sysfs inode cache is reclaimed未关闭
难度 2/5 1-3 小时 新手友好度 82/100
firewalla/firerouter#2180 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
andromarces/agent-loops#976 ·
维护者通常 1 天内回复