类型错误:无法在布尔值“true”上创建属性“mobxinstancecount”
at Object.<anonymous> (node_modules/mobx/lib/mobx.js:2620:38)
at Object.<anonymous> (src/Stores/DashboardStore.ts:9:14)
at Object.<anonymous> (src/__tests__/DashboardStore.test.ts:3:24)
Test Suites: 1 failed, 1 total
mobx.js:2620 mentions about global multiple instance.
仪表板.test.ts
从“../stores/dashboardstore”导入dashboardstore;
describe('DashboardStore', () => {
let dashboardStore;
beforeEach(() => {
dashboardStore = DashboardStore;
});
// tslint:disable-next-line:no-console
console.log(dashboardStore);
});
FAIL src\__tests__\DashboardStore.test.ts
? Test suite failed to run
我的请求是关于如何对组件进行单元测试和存储提供一些提示。
谢谢你。
最佳答案
我不知道为什么,对我来说,当我试图将窗口声明为全局时,jest配置文件出现了问题。