独立使用测试库
Using Testing Library in standalone
我试图做一些类似于 Testing Playground but I don't know which JavaScript file to include to have access to all the Testing Library 本机函数的事情。
目标是能够在浏览器控制台中 运行 查询,如 getAllByRole
。我不想拥有一个 Node 项目 运行ning。我只想要一个包含测试库 JavaScript 文件的基本 HTML 文件,这样我就可以 运行 它在浏览器控制台中的功能。
要在没有任何捆绑工具的情况下开始,请尝试 skypack
CDN 中的 @testing-library/dom
库,它为本机 JavaScript ES6 导入用法准备 npm 包。 (这是 codepen.io 中使用的那个)
<script type="module">
import { getByRole } from "https://cdn.skypack.dev/@testing-library/dom@7.29.6";
console.log(getByRole)
</script>
我试图做一些类似于 Testing Playground but I don't know which JavaScript file to include to have access to all the Testing Library 本机函数的事情。
目标是能够在浏览器控制台中 运行 查询,如 getAllByRole
。我不想拥有一个 Node 项目 运行ning。我只想要一个包含测试库 JavaScript 文件的基本 HTML 文件,这样我就可以 运行 它在浏览器控制台中的功能。
要在没有任何捆绑工具的情况下开始,请尝试 skypack
CDN 中的 @testing-library/dom
库,它为本机 JavaScript ES6 导入用法准备 npm 包。 (这是 codepen.io 中使用的那个)
<script type="module">
import { getByRole } from "https://cdn.skypack.dev/@testing-library/dom@7.29.6";
console.log(getByRole)
</script>