我在 Jest 中遇到以下错误,但不清楚为什么即使添加了 testEnvironmentOptions
TypeError: Cannot read properties of undefined (reading 'testEnvironmentOptions')
at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:72:28)
at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at async runJest (node_modules/@jest/core/build/runJest.js:404:19)
Run Code Online (Sandbox Code Playgroud)
这是我的 Jest 配置package.json:
TypeError: Cannot read properties of undefined (reading 'testEnvironmentOptions')
at new JSDOMEnvironment (node_modules/jest-environment-jsdom/build/index.js:72:28)
at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at async runJest (node_modules/@jest/core/build/runJest.js:404:19)
Run Code Online (Sandbox Code Playgroud) 我们的团队使用 Material UI 已经有一段时间了,我们很喜欢它。随着 Material UI v5 的发布,我们花时间检查下一步将使用哪种样式解决方案,因为 JSS 已被 MUI 团队放弃。
我们最终关注了Shopify 人员的讨论。他们对造型解决方案进行了非常详细的比较,最终选择了香草精作为他们的选择工具。强大的 TypeScript 支持,以及最重要的零运行时方法,让我们深信不疑。
遗憾的是,MUI 核心团队在决策时并未考虑香草精。
根据他们的文档, Material UI使用户能够使用各种样式解决方案。可以配置在引擎盖下使用的造型引擎,大致如下所述此处。
问题:
与通常的做法相反,我还没有真正尝试过任何实现方面的方法。根据我的理解,这意味着创建类似于mui-styled-engine(包裹情感)和mui-styled-engine-sc(包裹 styled-components)的东西。因为这对我来说似乎很复杂,所以我想我应该先问一下。
在VS Code中,如何跳转到调试器的当前位置?它由一条淡黄色的线表示,但我倾向于在浏览其他文件和功能时迷失方向,只能努力找到返回调试会话当前暂停的位置的方法。
应该足够简单,但我在文档中找不到任何内容。我什至经历了键盘映射中包含“调试”的所有操作,但没有找到我要找的东西。
debugging keyboard-shortcuts visual-studio-code vscode-settings
我想通过图表api接收公共页面事件的数据.我已经做了很长一段时间了,但突然间我的代码不再工作了.
以页面ID 128431033877314为例.图形api GET调用
128431033877314/events
按预期提供此页面的事件列表.其中,例如,ID为158032248286483的事件.尝试接收此事件的任何数据失败,返回我最喜欢的图形api错误:
{
"error": {
"message": "Unsupported get request. Object with ID '158032248286483'
does not exist, cannot be loaded due to missing permissions, or does
not support this operation. Please read the Graph API documentation
at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "GN5BhnWsN5O"
}
}
我试图访问/158032248286483和158032248286483?fields=id,我已经使用了图形API资源管理器来检查不同的版本(2.6和2.12),我曾与用户,页面和应用访问令牌试过.一切都是徒劳.返回的任何其他事件也是如此.
正如我所说 - 这肯定在以前工作过.我很难想象这是一个bug,因为它会影响相当重要的图形api功能.所以我想我在这里错过了一些东西.有人可以告诉我它是什么?
非常感谢提前!
(async function iife () {
const numbers = [1, 2, 3, 4]
let count = 0
async function returnNumberAsync (number) {
return new Promise(resolve => {
setTimeout(() => resolve(number), 0)
})
}
await Promise.all(numbers.map(async number => {
count += await returnNumberAsync(number)
}))
console.log(count)
})()
Run Code Online (Sandbox Code Playgroud)
此代码段记录4到控制台,这完全超出了我的范围。一旦将内部的承诺值分配map给它自己的局部变量…
const result = await returnNumberAsync(number)
count += result;
Run Code Online (Sandbox Code Playgroud)
…它的记录10与我期望的一样。当我count += await …??
考虑来自 MDN 的这个基本的AsyncIterator 示例:
var asyncIterable = {
[Symbol.asyncIterator]() {
return {
i: 0,
next() {
if (this.i < 3) {
return Promise.resolve({ value: this.i++, done: false });
}
return Promise.resolve({ done: true });
}
};
}
};
(async function() {
for await (let num of asyncIterable) {
console.log(num);
}
})();
Run Code Online (Sandbox Code Playgroud)
在节点 10.16.0 上运行它可以正常工作。但是,我似乎无法通过 Typescript 运行它。使用这个 tsconfig:
{
"compilerOptions": {
"lib": ["es2016", "esnext.asynciterable"],
"target": "es2016"
}
}
Run Code Online (Sandbox Code Playgroud)
导致错误The type returned by the 'next()' method of …
async-await ×2
javascript ×2
css-in-js ×1
debugging ×1
facebook ×1
jestjs ×1
material-ui ×1
node.js ×1
reactjs ×1
scope ×1
typescript ×1
unit-testing ×1