Jest: TypeError: Cannot read property of undefined
问题 Im trying to test my React class, that has import dotnetify from "dotnetify"; import. That works fine, but Jest says, that dotnetify is undefined. If i change to import dotnetify = require("dotnetify"); , Jest passes test, but this is silly workaround. How to explain Jest, that dotnetify is not undefined? Than you in advance. 回答1: This cannot be 'explained' to Jest, it's really undefined. There are several ways to handle CommonJS modules in TypeScript. As explained in this answer, there will