Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我们有三个模块名称A,那么模块需要B和需要:这个调用会产生什么效果?CABBC
A
B
C
var A = proxyquire('A', {'C': mockedModule})
模块B会得到模拟模块还是真实C模块?
但是您可以嵌套 proxyquire 语句,因此在您的示例中,您可以:
const A = proxyquire('A', { 'B': proxyquire('B', { C: mockC }) });